-
Notifications
You must be signed in to change notification settings - Fork 848
sae: Implement AtomicRequests on custom txs #5325
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
Changes from 151 commits
eb8c0a0
e248997
253c255
3cca8aa
6346d2e
ab83fe6
8f3f888
83cc38b
d606762
0a82734
5b86b6b
3d92bd5
893e17e
83b0ec0
c46bcc2
e92638f
f2faffb
7447b08
8c3b6f0
0369966
85ae854
88a234a
4e261c6
7073c57
d63857d
06d2a41
c28b2d2
aba7590
ca2a5ea
4be05cf
e721e6c
9b4c83f
5d9dd0d
2929163
af11c7e
c583599
2ffbf74
093fbdc
7e58c8e
ae780ec
8573565
2d50a62
2f01ee8
b28d132
f12a1b4
258df6f
8cefe95
fa25c9a
95e7256
5d2ef23
46814f4
58306f5
88c09d1
271658d
9da6af8
7bcb962
34b1457
692f899
eedd62e
e1ece39
9e3bb98
1220398
a4bad9b
56850ce
a41e9a6
22ebf97
c74091e
cefd09f
2ed8fcb
bd9366e
05ddba9
192a266
3fd9a97
fca7808
f47cf40
5bdb2df
1ede276
01cc4cf
bc6aed5
666066d
0de4a41
87d29d2
8535be8
6e9545c
47fe30d
adeaa57
6350008
05bb2f4
ba1afe1
166a9c2
e9487dc
3e3e6aa
9ffcd6c
980daa5
963c295
937c6f8
8ae1a82
3d11e3b
d39ed4d
18c3c2b
ce459c0
05930e4
9e0ffe5
7f3d20d
99f52e1
18a656e
63fb810
8bb04f6
e6a1d35
28419a7
149b1cb
a781d21
23b9916
c1b9fa8
b4d98b5
81c3c02
9e36643
61dcfbd
ca7c26b
268f6ed
5334079
40c3ba6
3ed6547
f0515ec
6dbe653
9ae76cc
6838983
4e67fcf
d44b9e6
c5df5ae
900d328
bcc4037
5370371
7eb1978
b9c18ef
21cdd76
cfd18da
b555a85
a5c21d1
eb701ee
1ad0654
f37215f
ac82445
cab3300
8fe92a5
3f7b7c6
efca198
51a986d
86b2b6e
904a654
a24de25
66ed39e
fcc28ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ | |
| "github.com/ava-labs/avalanchego/vms/saevm/hook" | ||
| "github.com/ava-labs/avalanchego/vms/secp256k1fx" | ||
|
|
||
| chainsatomic "github.com/ava-labs/avalanchego/chains/atomic" | ||
| safemath "github.com/ava-labs/avalanchego/utils/math" | ||
| ) | ||
|
|
||
|
|
@@ -35,12 +36,14 @@ | |
| var ( | ||
| AVAXAssetID = ids.FromStringOrPanic("FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z") | ||
| Tests = [...]struct { | ||
| Name string | ||
| Old *atomic.Tx | ||
| New *Tx | ||
| JSON string | ||
| Bytes []byte | ||
| Op hook.Op | ||
| Name string | ||
| Old *atomic.Tx | ||
| New *Tx | ||
| JSON string | ||
| Bytes []byte | ||
| Op hook.Op | ||
| AtomicRequestsChainID ids.ID | ||
| AtomicRequests *chainsatomic.Requests | ||
|
Comment on lines
+39
to
+46
Contributor
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. I feel like this is getting pretty dense, and could maybe be split into more focused helpers / tables?
Contributor
Author
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. I agree, but this is also the last modification to this Tests vector that I'm planning on making...
Contributor
Author
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. I can't think of anything better... Sooo
Contributor
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. If someone else is concerned about this in the future, I think it's worth taking another look at. It does make tests harder to reason about and compartmentalize. Not blocking though |
||
| }{ | ||
| { | ||
| Name: "import", // Included in https://subnets.avax.network/c-chain/block/4 | ||
|
|
@@ -147,6 +150,12 @@ | |
| common.HexToAddress("0xb8b5a87d1c05676f1f966da49151fa54dbe68c33"): scaleAVAX(50_000_000), | ||
| }, | ||
| }, | ||
| AtomicRequestsChainID: ids.FromStringOrPanic("2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM"), | ||
| AtomicRequests: &chainsatomic.Requests{ | ||
| RemoveRequests: [][]byte{ | ||
| common.FromHex("0xfd9e10917c4a2dab395683cfb766cdc584eba118bc22d3d0fc356fb79345cf64"), | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| Name: "export", // Included in https://subnets.avax.network/c-chain/block/48 | ||
|
|
@@ -256,6 +265,16 @@ | |
| }, | ||
| }, | ||
| }, | ||
| AtomicRequestsChainID: ids.FromStringOrPanic("2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM"), | ||
| AtomicRequests: &chainsatomic.Requests{ | ||
| PutRequests: []*chainsatomic.Element{{ | ||
| Key: common.FromHex("0x38ebe8fc127b2eaeeb25c72a747e0ef27460fb04b5929568ed959d67ec3e4948"), | ||
| Value: common.FromHex("0x000067b5812292324365c6e2a479b2601cd1cd1facc2fcc8c29d58b5ed96583ea17e0000000021e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff00000007000000000000000100000000000000000000000100000001d6ce17826dd7c12a7577af257e82d99143b72500"), | ||
| Traits: [][]byte{ | ||
| ids.ShortFromStringOrPanic("LanVZgBDVvtarbTXD1uU7r1nXVJyLmPUz").Bytes(), | ||
| }, | ||
| }}, | ||
| }, | ||
| }, | ||
| { | ||
| Name: "import_multi_input", // Included in https://subnets.avax.network/c-chain/block/132481 | ||
|
|
@@ -465,6 +484,14 @@ | |
| common.HexToAddress("0x383c293db6be7ac246f0956ad632344dc2cd1da3"): scaleAVAX(597_000_000), | ||
| }, | ||
| }, | ||
| AtomicRequestsChainID: ids.FromStringOrPanic("2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM"), | ||
| AtomicRequests: &chainsatomic.Requests{ | ||
| RemoveRequests: [][]byte{ | ||
| common.FromHex("0x821514ed5d925142159bc2c78bc56b043200e53aab79e97ca75e7ca7f6a96d05"), | ||
| common.FromHex("0xea05e5c7135613b689d9f6b9903f431067ed72a2957ca82a652de1e8fef2c630"), | ||
| common.FromHex("0xd71fb48751f6d5732e7ff63168ed311b40bf517b36279e326878fc3f5169a656"), | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| Name: "export_same_address_multi_asset", // Synthetic | ||
|
|
@@ -528,6 +555,9 @@ | |
| }, | ||
| }, | ||
| }, | ||
| AtomicRequests: &chainsatomic.Requests{ | ||
| PutRequests: []*chainsatomic.Element{}, | ||
| }, | ||
| }, | ||
| { | ||
| Name: "export_multi_address_multi_asset", // Synthetic | ||
|
|
@@ -598,6 +628,9 @@ | |
| }, | ||
| }, | ||
| }, | ||
| AtomicRequests: &chainsatomic.Requests{ | ||
| PutRequests: []*chainsatomic.Element{}, | ||
| }, | ||
| }, | ||
| { | ||
| Name: "import_non_avax", // Synthetic | ||
|
|
@@ -659,6 +692,11 @@ | |
| Gas: 10226, | ||
| Mint: map[common.Address]uint256.Int{}, | ||
| }, | ||
| AtomicRequests: &chainsatomic.Requests{ | ||
| RemoveRequests: [][]byte{ | ||
| common.FromHex("0x2c34ce1df23b838c5abf2a7f6437cca3d3067ed509ff25f11df6b11b582b51eb"), | ||
| }, | ||
| }, | ||
| }, | ||
| } | ||
| OldTxs []*atomic.Tx | ||
|
|
@@ -1107,3 +1145,14 @@ | |
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestAtomicRequests(t *testing.T) { | ||
| for _, test := range Tests { | ||
| t.Run(test.Name, func(t *testing.T) { | ||
| chainID, requests, err := test.New.AtomicRequests() | ||
| require.NoErrorf(t, err, "%T.AtomicRequests()", test.New) | ||
| assert.Equalf(t, test.AtomicRequestsChainID, chainID, "%T.AtomicRequests().ChainID", test.New) | ||
| assert.Equalf(t, test.AtomicRequests, requests, "%T.AtomicRequests().Requests", test.New) | ||
| }) | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.