-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1743 from multiversx/crypto-opcodes
impl new crypto opcodes
- Loading branch information
Showing
20 changed files
with
757 additions
and
18 deletions.
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
80 changes: 80 additions & 0 deletions
80
...s/feature-tests/basic-features/scenarios/crypto_verify_bls_aggregated_signature.scen.json
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
"name": "crypto", | ||
"comment": "does not currently work with scenarios-rs, because verify_bls function is not yet mocked", | ||
"gasSchedule": "v3", | ||
"steps": [ | ||
{ | ||
"step": "setState", | ||
"accounts": { | ||
"sc:basic-features-crypto": { | ||
"nonce": "0", | ||
"balance": "0", | ||
"code": "mxsc:../output/basic-features-crypto.mxsc.json" | ||
}, | ||
"address:an_account": { | ||
"nonce": "0", | ||
"balance": "0" | ||
} | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "bls multi - ok", | ||
"tx": { | ||
"from": "address:an_account", | ||
"to": "sc:basic-features-crypto", | ||
"function": "verify_bls_aggregated_signature", | ||
"arguments": [ | ||
[ | ||
"nested:0x95f1d96b582f35294eb7dd4589b158e108e1d94cd0dd71ef16140e9b37126ec52dac6f57397f1e041acd7bb77df1d214f9f894e3b7fbf7abeaabc9fab8ff5c2ef05f9841322f301fdb900ac59479c334ac76a2d4ff992cd49bc9b530c25ee293", | ||
"nested:0x97aa2862418eb4ea74fddcb511eef9b771e07ff901e7e6abb35847a4bb81e58f189fc9bce4186c6129014fb43002300e959702ef4b9d0c32ebe4d795457095d65b5414efb36edbb8dc66d84a445a92472d4a31cedd4700d5ebb885eb11d3430b", | ||
"nested:0x37b73265936a2aaafe652a4dd451a1851c2dbbb32208604787479b31033e2a354615562ea2a5488f9134843362477a139050a0e798dd5ce0f01b35b8d473454ae99633aadde9237f84c87eb366144cca4de3d2cc6acc35e522a3294bf1186800", | ||
"nested:0xf46c10d114dcd3019dd4bcd4152fda678c56144eb177c67a6411213b86e206e4e56a9aad1eab0313b13031fda046d715ec4a02612b083dfae0d82a23b643e1a89756c0df3d65c27e87a9c1289628d1a8404f0668a3d87c7451ba1c78fc452693", | ||
"nested:0xaa0a97917df9240c537c89e873d7baa5ce1796e8fedfb23cf682b80fa19b8baae35af3754f9b8149985cb2a1fbda0f02c2942d2c99d9af556c9a5e90b8170e6a96379a45dd69351abfb814a16b5665abb7ddb8b096ee9f273de81845cda9728a" | ||
], | ||
"str:message0", | ||
"0xae12858363e8caa5b398d3febdd7bc01bc2fae1fef8f486ff4d84a5f3342f2d38085904eb10b73c0879a45d23585ce8f" | ||
], | ||
"gasLimit": "50,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": [], | ||
"status": "", | ||
"logs": "*", | ||
"gas": "*", | ||
"refund": "*" | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "bls multi - fail", | ||
"tx": { | ||
"from": "address:an_account", | ||
"to": "sc:basic-features-crypto", | ||
"function": "verify_bls_aggregated_signature", | ||
"arguments": [ | ||
[ | ||
"nested:0x95f1d96b582f35294eb7dd4589b158e108e1d94cd0dd71ef16140e9b37126ec52dac6f57397f1e041acd7bb77df1d214f9f894e3b7fbf7abeaabc9fab8ff5c2ef05f9841322f301fdb900ac59479c334ac76a2d4ff992cd49bc9b530c25ee293", | ||
"nested:0x97aa2862418eb4ea74fddcb511eef9b771e07ff901e7e6abb35847a4bb81e58f189fc9bce4186c6129014fb43002300e959702ef4b9d0c32ebe4d795457095d65b5414efb36edbb8dc66d84a445a92472d4a31cedd4700d5ebb885eb11d3430b", | ||
"nested:0x37b73265936a2aaafe652a4dd451a1851c2dbbb32208604787479b31033e2a354615562ea2a5488f9134843362477a139050a0e798dd5ce0f01b35b8d473454ae99633aadde9237f84c87eb366144cca4de3d2cc6acc35e522a3294bf1186800", | ||
"nested:0xf46c10d114dcd3019dd4bcd4152fda678c56144eb177c67a6411213b86e206e4e56a9aad1eab0313b13031fda046d715ec4a02612b083dfae0d82a23b643e1a89756c0df3d65c27e87a9c1289628d1a8404f0668a3d87c7451ba1c78fc452693", | ||
"nested:0xaa0a97917df9240c537c89e873d7baa5ce1796e8fedfb23cf682b80fa19b8baae35af3754f9b8149985cb2a1fbda0f02c2942d2c99d9af556c9a5e90b8170e6a96379a45dd69351abfb814a16b5665abb7ddb8b096ee9f273de81845cda9728a" | ||
], | ||
"str:message0", | ||
"0x0012858363e8caa5b398d3febdd7bc01bc2fae1fef8f486ff4d84a5f3342f2d38085904eb10b73c0879a45d23585ce8f" | ||
], | ||
"gasLimit": "50,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": [], | ||
"status": "10", | ||
"message": "str:err blsSignatureDeserialize 0012858363e8caa5b398d3febdd7bc01bc2fae1fef8f486ff4d84a5f3342f2d38085904eb10b73c0879a45d23585ce8f", | ||
"logs": "*", | ||
"gas": "*", | ||
"refund": "*" | ||
} | ||
} | ||
] | ||
} |
68 changes: 68 additions & 0 deletions
68
contracts/feature-tests/basic-features/scenarios/crypto_verify_bls_share.scen.json
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"name": "crypto", | ||
"comment": "does not currently work with scenarios-rs, because function is not yet mocked", | ||
"gasSchedule": "v3", | ||
"steps": [ | ||
{ | ||
"step": "setState", | ||
"accounts": { | ||
"sc:basic-features-crypto": { | ||
"nonce": "0", | ||
"balance": "0", | ||
"code": "mxsc:../output/basic-features-crypto.mxsc.json" | ||
}, | ||
"address:an_account": { | ||
"nonce": "0", | ||
"balance": "0" | ||
} | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "verify_bls_signature_share - Ok", | ||
"tx": { | ||
"from": "address:an_account", | ||
"to": "sc:basic-features-crypto", | ||
"function": "verify_bls_signature_share", | ||
"arguments": [ | ||
"0x3e886a4c6e109a151f4105aee65a5192d150ef1fa68d3cd76964a0b086006dbe4324c989deb0e4416c6d6706db1b1910eb2732f08842fb4886067b9ed191109ac2188d76002d2e11da80a3f0ea89fee6b59c834cc478a6bd49cb8a193b1abb16", | ||
"0xe96bd0f36b70c5ccc0c4396343bd7d8255b8a526c55fa1e218511fafe6539b8e", | ||
"0x04725db195e37aa237cdbbda76270d4a229b6e7a3651104dc58c4349c0388e8546976fe54a04240530b99064e434c90f" | ||
], | ||
"gasLimit": "50,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": [], | ||
"status": "", | ||
"logs": "*", | ||
"gas": "*", | ||
"refund": "*" | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "verify_bls_signature_share - Fail", | ||
"tx": { | ||
"from": "address:an_account", | ||
"to": "sc:basic-features-crypto", | ||
"function": "verify_bls_signature_share", | ||
"arguments": [ | ||
"0x3e886a4c6e109a151f4105aee65a5192d150ef1fa68d3cd76964a0b086006dbe4324c989deb0e4416c6d6706db1b1910eb2732f08842fb4886067b9ed191109ac2188d76002d2e11da80a3f0ea89fee6b59c834cc478a6bd49cb8a193b1abb16", | ||
"0xe96bd0f36b70c5ccc0c4396343bd7d8255b8a526c55fa1e218511fafe6539b8e", | ||
"0xff725db195e37aa237cdbbda76270d4a229b6e7a3651104dc58c4349c0388e8546976fe54a04240530b99064e434c90f" | ||
], | ||
"gasLimit": "50,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": [], | ||
"status": "10", | ||
"message": "str:err blsSignatureDeserialize ff725db195e37aa237cdbbda76270d4a229b6e7a3651104dc58c4349c0388e8546976fe54a04240530b99064e434c90f", | ||
"logs": "*", | ||
"gas": "*", | ||
"refund": "*" | ||
} | ||
} | ||
] | ||
} |
67 changes: 67 additions & 0 deletions
67
contracts/feature-tests/basic-features/scenarios/crypto_verify_secp256r1.scen.json
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"name": "crypto", | ||
"gasSchedule": "v3", | ||
"steps": [ | ||
{ | ||
"step": "setState", | ||
"accounts": { | ||
"sc:basic-features-crypto": { | ||
"nonce": "0", | ||
"balance": "0", | ||
"code": "mxsc:../output/basic-features-crypto.mxsc.json" | ||
}, | ||
"address:an_account": { | ||
"nonce": "0", | ||
"balance": "0" | ||
} | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "secp256r1 - ok", | ||
"tx": { | ||
"from": "address:an_account", | ||
"to": "sc:basic-features-crypto", | ||
"function": "verify_secp256r1_signature", | ||
"arguments": [ | ||
"0x02bc52274edebbef8878eacc4d1e0ed4fb213e5b0737389701ae8d59c403325720", | ||
"0xbf9facf48b2219db73b50c7ff59ceef2ada56632c71afc555d6bb4072d7634d1d9353acd53517ffb9a06935a89a6454fcaa40c69becf9f8029a271fd252ea55307d00d6e97a30719d48d6b7f993af24e9c54381cba02a113238eaee9d741cababeb21aaf", | ||
"0xc7877497444274267a4ea6f42deefde23a12e44f1ec1b437018e5c0e2834ce376dec1b81ebeacf5fbc6882e69af7cafad47bbb96cfb09e8d77d12afff7543052" | ||
], | ||
"gasLimit": "50,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": [], | ||
"status": "", | ||
"logs": "*", | ||
"gas": "*", | ||
"refund": "*" | ||
} | ||
}, | ||
{ | ||
"step": "scCall", | ||
"id": "secp256r1 - fail", | ||
"tx": { | ||
"from": "address:an_account", | ||
"to": "sc:basic-features-crypto", | ||
"function": "verify_secp256r1_signature", | ||
"arguments": [ | ||
"0x02bc52274edebbef8878eacc4d1e0ed4fb213e5b0737389701ae8d59c403325720", | ||
"0xbf9facf48b2219db73b50c7ff59ceef2ada56632c71afc555d6bb4072d7634d1d9353acd53517ffb9a06935a89a6454fcaa40c69becf9f8029a271fd252ea55307d00d6e97a30719d48d6b7f993af24e9c54381cba02a113238eaee9d741cababeb21aaf", | ||
"0x00877497444274267a4ea6f42deefde23a12e44f1ec1b437018e5c0e2834ce376dec1b81ebeacf5fbc6882e69af7cafad47bbb96cfb09e8d77d12afff7543052" | ||
], | ||
"gasLimit": "50,000,000", | ||
"gasPrice": "0" | ||
}, | ||
"expect": { | ||
"out": [], | ||
"status": "10", | ||
"message": "str:signature verification failed", | ||
"logs": "*", | ||
"gas": "*", | ||
"refund": "*" | ||
} | ||
} | ||
] | ||
} |
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 |
---|---|---|
|
@@ -143,4 +143,4 @@ | |
} | ||
} | ||
] | ||
} | ||
} |
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 |
---|---|---|
|
@@ -372,4 +372,4 @@ | |
} | ||
} | ||
] | ||
} | ||
} |
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 |
---|---|---|
|
@@ -87,4 +87,4 @@ | |
} | ||
} | ||
] | ||
} | ||
} |
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
Oops, something went wrong.