Skip to content

Commit

Permalink
patch address & topics parsing in parseLog
Browse files Browse the repository at this point in the history
  • Loading branch information
RnkSngh committed Dec 20, 2024
1 parent edc2503 commit b9d478c
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 16 deletions.
10 changes: 9 additions & 1 deletion contracts/libs/Ibc.sol
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ library Ibc {
outStr = string(buffer);
}

function bytesToAddr(bytes memory a) public pure returns (address addr) {
assembly {
addr := mload(add(a, 20))
}
}

function parseLog(uint256 logIndex, bytes memory receiptRLP)
internal
pure
Expand Down Expand Up @@ -315,11 +321,13 @@ library Ibc {
// }
RLPReader.RLPItem[] memory log = RLPReader.readList(RLPReader.readList(receipt[3])[logIndex]);

emittingContract = address(uint160(uint256(bytes32(RLPReader.readBytes(log[0])))));
emittingContract = bytesToAddr(RLPReader.readBytes(log[0]));

RLPReader.RLPItem[] memory encodedTopics = RLPReader.readList(log[1]);
unindexedData = (RLPReader.readBytes(log[2])); // This is the raw unindexed data. in this case it's
// just an abi encoded uint64

topics = new bytes[](encodedTopics.length);
for (uint256 i = 0; i < encodedTopics.length; i++) {
topics[i] = RLPReader.readBytes(encodedTopics[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@open-ibc/vibc-core-smart-contracts",
"version": "4.0.18",
"version": "4.0.19",
"main": "dist/index.js",
"bin": {
"verify-vibc-core-smart-contracts": "./dist/scripts/verify-contract-script.js",
Expand Down
14 changes: 14 additions & 0 deletions src/evm/contracts/Ibc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export interface IbcInterface extends Interface {
nameOrSignature:
| "ackProofKey"
| "ackProofValue"
| "bytesToAddr"
| "channelProofKey"
| "channelProofKeyMemory"
| "channelProofValue"
Expand All @@ -93,6 +94,10 @@ export interface IbcInterface extends Interface {
functionFragment: "ackProofValue",
values: [BytesLike]
): string;
encodeFunctionData(
functionFragment: "bytesToAddr",
values: [BytesLike]
): string;
encodeFunctionData(
functionFragment: "channelProofKey",
values: [string, BytesLike]
Expand Down Expand Up @@ -138,6 +143,10 @@ export interface IbcInterface extends Interface {
functionFragment: "ackProofValue",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "bytesToAddr",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "channelProofKey",
data: BytesLike
Expand Down Expand Up @@ -223,6 +232,8 @@ export interface Ibc extends BaseContract {

ackProofValue: TypedContractMethod<[ack: BytesLike], [string], "view">;

bytesToAddr: TypedContractMethod<[a: BytesLike], [string], "view">;

channelProofKey: TypedContractMethod<
[portId: string, channelId: BytesLike],
[string],
Expand Down Expand Up @@ -297,6 +308,9 @@ export interface Ibc extends BaseContract {
getFunction(
nameOrSignature: "ackProofValue"
): TypedContractMethod<[ack: BytesLike], [string], "view">;
getFunction(
nameOrSignature: "bytesToAddr"
): TypedContractMethod<[a: BytesLike], [string], "view">;
getFunction(
nameOrSignature: "channelProofKey"
): TypedContractMethod<
Expand Down
2 changes: 1 addition & 1 deletion src/evm/contracts/factories/CrossL2Prover__factory.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/evm/contracts/factories/Dispatcher__factory.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/evm/contracts/factories/Earth__factory.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/evm/contracts/factories/FeeVault__factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ const _abi = [
] as const;

const _bytecode =
"0x608060405234801561001057600080fd5b5061001a33610024565b600160025561009b565b600180546001600160a01b03191690556100488161004b602090811b6103f617901c565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6109c5806100aa6000396000f3fe60806040526004361061007b5760003560e01c80638da5cb5b1161004e5780638da5cb5b146100d4578063e30c39781461010a578063f2fde38b14610128578063fce34e401461014857600080fd5b80630be6a22d1461008057806318e3404b14610097578063715018a6146100aa57806379ba5097146100bf575b600080fd5b34801561008c57600080fd5b5061009561015b565b005b6100956100a5366004610527565b610198565b3480156100b657600080fd5b50610095610275565b3480156100cb57600080fd5b50610095610289565b3480156100e057600080fd5b506000546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b34801561011657600080fd5b506001546001600160a01b03166100ee565b34801561013457600080fd5b506100956101433660046105a1565b610300565b610095610156366004610676565b610371565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610195573d6000803e3d6000fd5b50565b6101a0610446565b633b9aca003410156101c557604051633b9b24db60e01b815260040160405180910390fd5b60006101d9602080840135908501356107b4565b6101e5833585356107b4565b6101ef91906107d3565b905034811461021f57604051635c6dd11360e11b8152600481018290523460248201526044015b60405180910390fd5b8367ffffffffffffffff16857f0733dc80f277e205edf5d913fa5d91fa0c4cc2635db600b365471c688356c034858560405161025c9291906107eb565b60405180910390a35061026f6001600255565b50505050565b61027d61049d565b61028760006104f7565b565b60015433906001600160a01b031681146102f75760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610216565b610195816104f7565b61030861049d565b600180546001600160a01b0383166001600160a01b031990911681179091556103396000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b610379610446565b633b9aca0034101561039e57604051633b9b24db60e01b815260040160405180910390fd5b7f8ab5595b5ac9231b64513ba86f6bd9fb73c51cae40c36083f7dfc2298e4429e687878787878787346040516103db9897969594939291906108e4565b60405180910390a16103ed6001600255565b50505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60028054036104975760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610216565b60028055565b6000546001600160a01b031633146102875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610216565b600180546001600160a01b0319169055610195816103f6565b806040810183101561052157600080fd5b92915050565b60008060008060c0858703121561053d57600080fd5b84359350602085013567ffffffffffffffff8116811461055c57600080fd5b925061056b8660408701610510565b915061057a8660808701610510565b905092959194509250565b80356001600160a01b038116811461059c57600080fd5b919050565b6000602082840312156105b357600080fd5b6105bc82610585565b9392505050565b634e487b7160e01b600052604160045260246000fd5b80356003811061059c57600080fd5b60008083601f8401126105fa57600080fd5b50813567ffffffffffffffff81111561061257600080fd5b6020830191508360208260051b850101111561062d57600080fd5b9250929050565b60008083601f84011261064657600080fd5b50813567ffffffffffffffff81111561065e57600080fd5b60208301915083602082850101111561062d57600080fd5b600080600080600080600060a0888a03121561069157600080fd5b61069a88610585565b9650602088013567ffffffffffffffff808211156106b757600080fd5b818a0191508a601f8301126106cb57600080fd5b8135818111156106dd576106dd6105c3565b604051601f8201601f19908116603f01168101908382118183101715610705576107056105c3565b816040528281528d602084870101111561071e57600080fd5b82602086016020830137600060208483010152809a5050505061074360408b016105d9565b965060608a013591508082111561075957600080fd5b6107658b838c016105e8565b909650945060808a013591508082111561077e57600080fd5b5061078b8a828b01610634565b989b979a50959850939692959293505050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156107ce576107ce61079e565b500290565b600082198211156107e6576107e661079e565b500190565b6080810160408483376040836040840137600081529392505050565b6003811061082557634e487b7160e01b600052602160045260246000fd5b9052565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b878110156108d75782840389528135601e1988360301811261088d57600080fd5b8701858101903567ffffffffffffffff8111156108a957600080fd5b8036038213156108b857600080fd5b6108c3868284610829565b9a87019a955050509084019060010161086c565b5091979650505050505050565b60018060a01b03891681526000602060c08184015289518060c085015260005b81811015610920578b810183015185820160e001528201610904565b8181111561093257600060e083870101525b50601f01601f19168301905061094b604084018a610807565b60e083820301606084015261096460e08201888a610852565b90508281036080840152610979818688610829565b9150508260a0830152999850505050505050505056fea26469706673582212201161093bbffcfb06f2f7d30396d1a50cd9f927207b1d17e90b8a3f9844bf8b9b64736f6c634300080f0033";
"0x608060405234801561001057600080fd5b5061001a33610024565b600160025561009b565b600180546001600160a01b03191690556100488161004b602090811b6103f617901c565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6109c5806100aa6000396000f3fe60806040526004361061007b5760003560e01c80638da5cb5b1161004e5780638da5cb5b146100d4578063e30c39781461010a578063f2fde38b14610128578063fce34e401461014857600080fd5b80630be6a22d1461008057806318e3404b14610097578063715018a6146100aa57806379ba5097146100bf575b600080fd5b34801561008c57600080fd5b5061009561015b565b005b6100956100a5366004610527565b610198565b3480156100b657600080fd5b50610095610275565b3480156100cb57600080fd5b50610095610289565b3480156100e057600080fd5b506000546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b34801561011657600080fd5b506001546001600160a01b03166100ee565b34801561013457600080fd5b506100956101433660046105a1565b610300565b610095610156366004610676565b610371565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610195573d6000803e3d6000fd5b50565b6101a0610446565b633b9aca003410156101c557604051633b9b24db60e01b815260040160405180910390fd5b60006101d9602080840135908501356107b4565b6101e5833585356107b4565b6101ef91906107d3565b905034811461021f57604051635c6dd11360e11b8152600481018290523460248201526044015b60405180910390fd5b8367ffffffffffffffff16857f0733dc80f277e205edf5d913fa5d91fa0c4cc2635db600b365471c688356c034858560405161025c9291906107eb565b60405180910390a35061026f6001600255565b50505050565b61027d61049d565b61028760006104f7565b565b60015433906001600160a01b031681146102f75760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610216565b610195816104f7565b61030861049d565b600180546001600160a01b0383166001600160a01b031990911681179091556103396000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b610379610446565b633b9aca0034101561039e57604051633b9b24db60e01b815260040160405180910390fd5b7f8ab5595b5ac9231b64513ba86f6bd9fb73c51cae40c36083f7dfc2298e4429e687878787878787346040516103db9897969594939291906108e4565b60405180910390a16103ed6001600255565b50505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60028054036104975760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610216565b60028055565b6000546001600160a01b031633146102875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610216565b600180546001600160a01b0319169055610195816103f6565b806040810183101561052157600080fd5b92915050565b60008060008060c0858703121561053d57600080fd5b84359350602085013567ffffffffffffffff8116811461055c57600080fd5b925061056b8660408701610510565b915061057a8660808701610510565b905092959194509250565b80356001600160a01b038116811461059c57600080fd5b919050565b6000602082840312156105b357600080fd5b6105bc82610585565b9392505050565b634e487b7160e01b600052604160045260246000fd5b80356003811061059c57600080fd5b60008083601f8401126105fa57600080fd5b50813567ffffffffffffffff81111561061257600080fd5b6020830191508360208260051b850101111561062d57600080fd5b9250929050565b60008083601f84011261064657600080fd5b50813567ffffffffffffffff81111561065e57600080fd5b60208301915083602082850101111561062d57600080fd5b600080600080600080600060a0888a03121561069157600080fd5b61069a88610585565b9650602088013567ffffffffffffffff808211156106b757600080fd5b818a0191508a601f8301126106cb57600080fd5b8135818111156106dd576106dd6105c3565b604051601f8201601f19908116603f01168101908382118183101715610705576107056105c3565b816040528281528d602084870101111561071e57600080fd5b82602086016020830137600060208483010152809a5050505061074360408b016105d9565b965060608a013591508082111561075957600080fd5b6107658b838c016105e8565b909650945060808a013591508082111561077e57600080fd5b5061078b8a828b01610634565b989b979a50959850939692959293505050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156107ce576107ce61079e565b500290565b600082198211156107e6576107e661079e565b500190565b6080810160408483376040836040840137600081529392505050565b6003811061082557634e487b7160e01b600052602160045260246000fd5b9052565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b81835260006020808501808196508560051b810191508460005b878110156108d75782840389528135601e1988360301811261088d57600080fd5b8701858101903567ffffffffffffffff8111156108a957600080fd5b8036038213156108b857600080fd5b6108c3868284610829565b9a87019a955050509084019060010161086c565b5091979650505050505050565b60018060a01b03891681526000602060c08184015289518060c085015260005b81811015610920578b810183015185820160e001528201610904565b8181111561093257600060e083870101525b50601f01601f19168301905061094b604084018a610807565b60e083820301606084015261096460e08201888a610852565b90508281036080840152610979818688610829565b9150508260a0830152999850505050505050505056fea26469706673582212208e97f878eb727e646644467c9638a4cec1badcd3e8f9a519f89d2fd8b8566be464736f6c634300080f0033";

type FeeVaultConstructorParams =
| [signer?: Signer]
Expand Down
Loading

0 comments on commit b9d478c

Please sign in to comment.