-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add set local chainId Action #69
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,13 +10,6 @@ | |
namespace eosio { | ||
using bytes = std::vector<uint8_t>; | ||
namespace pam { | ||
// aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906 | ||
const bytes CHAIN_ID = { | ||
0xac, 0xa3, 0x76, 0xf2, 0x06, 0xb8, 0xfc, 0x25, | ||
0xa6, 0xed, 0x44, 0xdb, 0xdc, 0x66, 0x54, 0x7c, | ||
0x36, 0xc6, 0xc3, 0x3e, 0x3a, 0x11, 0x9f, 0xfb, | ||
0xea, 0xef, 0x94, 0x36, 0x42, 0xf0, 0xe9, 0x06 | ||
}; | ||
|
||
TABLE mappings { | ||
bytes chain_id; | ||
|
@@ -36,6 +29,10 @@ namespace eosio { | |
} | ||
}; | ||
|
||
TABLE local_chain_id { | ||
bytes chain_id; | ||
}; | ||
|
||
TABLE tee { | ||
public_key key; | ||
public_key updating_key; | ||
|
@@ -44,6 +41,7 @@ namespace eosio { | |
uint64_t change_grace_threshold = 0; | ||
}; | ||
|
||
using chain_id = singleton<"chainid"_n, local_chain_id>; | ||
using tee_pubkey = singleton<"tee"_n, tee>; | ||
typedef eosio::multi_index<"mappings"_n, mappings> mappings_table; | ||
|
||
|
@@ -77,7 +75,12 @@ namespace eosio { | |
// +----------- context ---------+------------- event ---------------+ | ||
check(context_checks(operation, metadata), "unexpected context"); | ||
|
||
chain_id _chain_id(adapter, adapter.value); | ||
check(_chain_id.exists(), "local chain id singleton not set"); | ||
bytes local_chain_id = _chain_id.get().chain_id; | ||
|
||
tee_pubkey _tee_pubkey(adapter, adapter.value); | ||
check(_tee_pubkey.exists(), "tee singleton not set"); | ||
public_key tee_key = _tee_pubkey.get().key; | ||
|
||
uint128_t offset = 2; | ||
|
@@ -148,7 +151,7 @@ namespace eosio { | |
|
||
bytes dest_chain_id = extract_32bytes(event_data, offset); | ||
check(operation.destinationChainId == dest_chain_id, "destination chain id does not match with the expected one"); | ||
check(CHAIN_ID == dest_chain_id, "destination chain id does not match with the current chain"); | ||
check(local_chain_id == dest_chain_id, "destination chain id does not match with the current chain"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
offset += 32; | ||
|
||
bytes amount = extract_32bytes(event_data, offset); | ||
|
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
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍