-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(fgw): sync from other nodes and block signature #307
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Note: This overrides the fgw url set by the current chain
`ChainConfig` has also been updated to include the contract addresses of the related network
Trantorian1
changed the title
fix(fgw): invalid JSON format when acting as provider
fix(fgw): fgw now works with Juno and Pathfinder
Oct 7, 2024
jbcaron
reviewed
Oct 8, 2024
this PR finally solves #72 🥳 |
Blocks are no longer stored in db with their signature. Instead, Madara is able to sign block it authors through the feeder gateway. Note that the private key is still exposed and needs to be zeroed. This will be address in a pr to the primitive libs being used.
Trantorian1
changed the title
fix(fgw): fgw now works with Juno and Pathfinder
fix(fgw): fgw now works with Juno and Pathfinder and block signature
Oct 9, 2024
Trantorian1
changed the title
fix(fgw): fgw now works with Juno and Pathfinder and block signature
fix(fgw): sync from other nodes and block signature
Oct 9, 2024
jbcaron
reviewed
Oct 10, 2024
jbcaron
approved these changes
Oct 10, 2024
Mohiiit
approved these changes
Oct 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull Request type
What is the current behavior?
The current Madara feeder gateway presents several issues and does not currently work when synchronizing from another node. This is due to invalid JSON response formats and missing fgw methods which other nodes like Pathfinder or Juno use. This pr aims to fix that.
What is the new behavior?
Performs manual serialization of legacy contract ABI into json as part of
serialize_to_json
. This has to be done manually sincebincode
, which is used to store contract ABI in db, does not support the#[serde(tag = "type")]
container attribute.Missing fgw methods
get_signature
get_compiled_class_by_class_hash
,get_contract_addresses
andget_public_key
have been added. This does not currently include all possible fgw methods. However, in the absence of a clear spec, this will at least work for the current versions of Juno and Pathfinder.Calls to the madara fgw now have their url normalized so partially invalid request such as
/foo///abc
will be evaluated correctly.Changes to how certain types are serialized to JSON by the fgw has been updated to more closely match the behavior of the official starknet.io fgw. In the future it would be nice to have this based on specs instead.
Proper block signing has has been implemented in the fgw: Madara now has a private key it uses to sign the hash of blocks it provides through the fgw. This is still not very secure and we are looking into ways to zeroize the private key and load it from env on use to limit its availabiltiy. Note that this fixes feat(sync): Utilize Signature Verification Methods to Secure L2-only Blocks #72
Does this introduce a breaking change?
Yes. Due to changes in some storage structure, existing dbs will need to be re-synchronized from genesis.