Provide abi encoded exit event in hex format from bridge_generateExitProof
JSON RPC
#1929
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In order to be able to rely on external tools for executing bridge transactions (such as Foundry),
bridge_generateExitProof
should return an abi-encoded exit event, instead of an object, so that it becomes possible to submit an exit transaction without the need to programmatically decode returned exit event and transforming it into ABI-encoded byte array. With this fix, it is possible to provide a given exit event straight away to the exit transaction (namely invoking theExitHelper.exit
function).This PR also changes the way the encode function is invoked for ABI events. Instead of accepting parameters to encode via
inputs
argument, now it uses already provided fields in each struct representing an ABI event.Foundry test scenario
These are the steps that represent the test scenario that bridges the Supernets native token to the rootchain and withdraws it back to the Supernets. This is just an example that uses predefined private keys, receiver addresses, and contract addresses. For the most part, those need to be adapted, based on real values.
private-key
andrpc-url
as well asamount
values accordingly. Also contract address in case non-native token is being bridged (use arbitrary ERC20 token address instead of0x0000000000000000000000000000000000001010
)private-key
andrpc-url
as well asreceiver
andamount
values accordingly.rpc-url
and exit event id as a parameter.CheckpointBlock
,LeafIndex
,ExitEvent
andProof
respectively). For contract address, provide address of theExitHelper
contract (it can be retrieved from thegenesis.json
exitHelperAddress
)private-key
,rpc-url
, contract address (it corresponds toerc20ChildMintablePredicateAddress
, which is acquired from the genesis.json),childToken
value (can be acquired by querying either root or child predicate,rootTokenToChildToken
and providing corresponding root token address as a key),receiver
andamount
parameters.Changes include
Checklist
Testing
Manual tests
Please complete this section if you ran manual tests for this functionality, otherwise delete it
Documentation update
Please link the documentation update PR in this section if it's present, otherwise delete it
Additional comments
Please post additional comments in this section if you have them, otherwise delete it