Skip to content
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

Implement extra args codec #16016

Merged
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a757a6e
Use SVM ABI, needs to check test
huangzhen1997 Jan 21, 2025
7253bba
goimport
huangzhen1997 Jan 21, 2025
0ec8119
update
huangzhen1997 Jan 21, 2025
82a162f
rename
huangzhen1997 Jan 21, 2025
2c7bd05
Merge branch 'solana-offchain-plugin' into NONEVM-1163/implement-extr…
huangzhen1997 Jan 21, 2025
e8bbe9a
tidy
huangzhen1997 Jan 21, 2025
36a5ad1
refactor
huangzhen1997 Jan 21, 2025
3fa671b
fix lint
huangzhen1997 Jan 22, 2025
af29932
fix
huangzhen1997 Jan 22, 2025
2597b48
update
huangzhen1997 Jan 22, 2025
a99bdcc
update
huangzhen1997 Jan 22, 2025
5fe01d2
address Makram comments
huangzhen1997 Jan 23, 2025
c49c04b
lint
huangzhen1997 Jan 23, 2025
7204973
Merge branch 'solana-offchain-plugin' into NONEVM-1163/implement-extr…
huangzhen1997 Jan 23, 2025
a903310
mod tidy
huangzhen1997 Jan 23, 2025
80b3e3b
gomd
huangzhen1997 Jan 23, 2025
afcd808
fix import
huangzhen1997 Jan 24, 2025
6bc6b29
fix broken integration test
huangzhen1997 Jan 24, 2025
a5f84ac
update
huangzhen1997 Jan 24, 2025
d6af37b
fix test
huangzhen1997 Jan 27, 2025
f9489ae
fix test
huangzhen1997 Jan 27, 2025
cf28c84
update source chain
huangzhen1997 Jan 27, 2025
67e0038
update test
huangzhen1997 Jan 27, 2025
a20765b
minor
huangzhen1997 Jan 27, 2025
ee10849
merge develop
huangzhen1997 Jan 28, 2025
f2952a0
implement and add test
huangzhen1997 Jan 28, 2025
a1eacf6
update comments
huangzhen1997 Jan 28, 2025
0b15808
goimport
huangzhen1997 Jan 28, 2025
55b33e3
fix conflicts
huangzhen1997 Jan 28, 2025
8d4d702
update
huangzhen1997 Jan 29, 2025
fc7f0f7
update
huangzhen1997 Jan 29, 2025
9939559
add comment
huangzhen1997 Jan 29, 2025
6e6441d
refactor
huangzhen1997 Jan 29, 2025
7e96d52
update comment
huangzhen1997 Jan 30, 2025
2e8de08
add unit test
huangzhen1997 Jan 30, 2025
5c76148
update
huangzhen1997 Jan 30, 2025
5bcf509
lint
huangzhen1997 Jan 30, 2025
8af2a50
mod tidy
huangzhen1997 Jan 30, 2025
aa9841d
update
huangzhen1997 Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update test
  • Loading branch information
huangzhen1997 committed Jan 27, 2025
commit 67e00386fbc6144914b55789578b198a974966d2
32 changes: 28 additions & 4 deletions core/capabilities/ccip/ccipevm/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,40 @@ func Test_decodeExtraArgs(t *testing.T) {
t.Run("decode extra args into map svm", func(t *testing.T) {
key, err := solana.NewRandomPrivateKey()
require.NoError(t, err)
decoded, err := d.contract.DecodeSVMExtraArgsV1(nil, 10000, 4, false, [32]byte(key.PublicKey().Bytes()), [][32]byte{
[32]byte(key.PublicKey().Bytes()),
})
cu := uint32(10000)
bitmap := uint64(4)
ooe := false
tokenReceiver := [32]byte(key.PublicKey().Bytes())
accounts := [][32]byte{[32]byte(key.PublicKey().Bytes())}
decoded, err := d.contract.DecodeSVMExtraArgsV1(nil, cu, bitmap, ooe, tokenReceiver, accounts)
if err != nil {
return
}
encoded, err := d.contract.EncodeSVMExtraArgsV1(nil, decoded)
require.NoError(t, err)

_, err = DecodeExtraArgsToMap(encoded)
m, err := DecodeExtraArgsToMap(encoded)
require.NoError(t, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once the test passes, we should verify the decoded data is same as originally passed in data.

require.Len(t, m, 5)

cuDecoded, exist := m["computeUnits"]
require.True(t, exist)
require.Equal(t, cuDecoded, cu)

bitmapDecoded, exist := m["accountIsWritableBitmap"]
require.True(t, exist)
require.Equal(t, bitmapDecoded, bitmap)

ooeDecoded, exist := m["allowOutOfOrderExecution"]
require.True(t, exist)
require.Equal(t, ooeDecoded, ooe)

tokenReceiverDecoded, exist := m["tokenReceiver"]
require.True(t, exist)
require.Equal(t, tokenReceiverDecoded, tokenReceiver)

accountsDecoded, exist := m["accounts"]
require.True(t, exist)
require.Equal(t, accountsDecoded, accounts)
})
}
Loading