diff --git a/clean.sh b/clean.sh index 94c50f6..c5f75b8 100755 --- a/clean.sh +++ b/clean.sh @@ -1,6 +1,6 @@ rm -rf test_suite_env || true -rm src/test_suite/invoke_pb2.py || true rm src/*.so || true make -C impl clean git submodule deinit --all -f +rm -rf protosol || true deactivate || true diff --git a/fetch_and_generate.sh b/fetch_and_generate.sh new file mode 100755 index 0000000..28a0b50 --- /dev/null +++ b/fetch_and_generate.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +# Fetch protosol +if [ ! -d protosol ]; then + git clone --depth=1 -q https://github.com/firedancer-io/protosol.git +else + cd protosol + git pull -q + cd .. +fi + +# Generate protobuf files with protoc +protoc --python_out=src/test_suite --proto_path=protosol/proto protosol/proto/*.proto +protol --in-place --python-out=src/test_suite protoc --proto-path=protosol/proto protosol/proto/*.proto diff --git a/generate.sh b/generate.sh deleted file mode 100755 index 5278ab9..0000000 --- a/generate.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -protoc --python_out=src/test_suite invoke.proto diff --git a/generators/ed25519.py b/generators/ed25519.py index 2f5be86..e2661b9 100644 --- a/generators/ed25519.py +++ b/generators/ed25519.py @@ -1,6 +1,7 @@ import fd58 import hashlib -import test_suite.invoke_pb2 as pb +import test_suite.invoke_pb2 as invoke_pb +import test_suite.context_pb2 as context_pb from dataclasses import dataclass import requests @@ -29,70 +30,1363 @@ [1, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], # Ok() (result: 0) # valid signature - [1, 0, 48, 0, 255, 255, 16, 0, 255, 255, 112, 0, 5, 0, 255, 255, 75, 214, 129, 151, 244, 149, 70, 192, 102, 135, 224, 99, 199, 172, 238, 204, 3, 67, 253, 92, 104, 212, 24, 116, 243, 199, 49, 42, 20, 156, 143, 83, 1, 148, 145, 203, 46, 109, 182, 75, 135, 218, 65, 3, 176, 77, 9, 53, 33, 86, 42, 178, 80, 169, 11, 169, 251, 61, 180, 51, 167, 39, 34, 189, 140, 51, 151, 209, 50, 76, 167, 90, 205, 1, 57, 197, 149, 97, 99, 241, 191, 66, 222, 90, 0, 251, 220, 145, 101, 24, 220, 32, 183, 0, 19, 5, 104, 101, 108, 108, 111], + [ + 1, + 0, + 48, + 0, + 255, + 255, + 16, + 0, + 255, + 255, + 112, + 0, + 5, + 0, + 255, + 255, + 75, + 214, + 129, + 151, + 244, + 149, + 70, + 192, + 102, + 135, + 224, + 99, + 199, + 172, + 238, + 204, + 3, + 67, + 253, + 92, + 104, + 212, + 24, + 116, + 243, + 199, + 49, + 42, + 20, + 156, + 143, + 83, + 1, + 148, + 145, + 203, + 46, + 109, + 182, + 75, + 135, + 218, + 65, + 3, + 176, + 77, + 9, + 53, + 33, + 86, + 42, + 178, + 80, + 169, + 11, + 169, + 251, + 61, + 180, + 51, + 167, + 39, + 34, + 189, + 140, + 51, + 151, + 209, + 50, + 76, + 167, + 90, + 205, + 1, + 57, + 197, + 149, + 97, + 99, + 241, + 191, + 66, + 222, + 90, + 0, + 251, + 220, + 145, + 101, + 24, + 220, + 32, + 183, + 0, + 19, + 5, + 104, + 101, + 108, + 108, + 111, + ], # InvalidPublicKey (result: 1) - [1, 0, 48, 0, 255, 255, 16, 0, 255, 255, 112, 0, 5, 0, 255, 255, 75, 214, 129, 151, 0, 149, 70, 192, 102, 135, 224, 99, 199, 172, 238, 204, 3, 67, 253, 92, 104, 212, 24, 116, 243, 199, 49, 42, 20, 156, 143, 83, 1, 148, 145, 203, 46, 109, 182, 75, 135, 218, 65, 3, 176, 77, 9, 53, 33, 86, 42, 178, 80, 169, 11, 169, 251, 61, 180, 51, 167, 39, 34, 189, 140, 51, 151, 209, 50, 76, 167, 90, 205, 1, 57, 197, 149, 97, 99, 241, 191, 66, 222, 90, 0, 251, 220, 145, 101, 24, 220, 32, 183, 0, 19, 5, 104, 101, 108, 108, 111] + [ + 1, + 0, + 48, + 0, + 255, + 255, + 16, + 0, + 255, + 255, + 112, + 0, + 5, + 0, + 255, + 255, + 75, + 214, + 129, + 151, + 0, + 149, + 70, + 192, + 102, + 135, + 224, + 99, + 199, + 172, + 238, + 204, + 3, + 67, + 253, + 92, + 104, + 212, + 24, + 116, + 243, + 199, + 49, + 42, + 20, + 156, + 143, + 83, + 1, + 148, + 145, + 203, + 46, + 109, + 182, + 75, + 135, + 218, + 65, + 3, + 176, + 77, + 9, + 53, + 33, + 86, + 42, + 178, + 80, + 169, + 11, + 169, + 251, + 61, + 180, + 51, + 167, + 39, + 34, + 189, + 140, + 51, + 151, + 209, + 50, + 76, + 167, + 90, + 205, + 1, + 57, + 197, + 149, + 97, + 99, + 241, + 191, + 66, + 222, + 90, + 0, + 251, + 220, + 145, + 101, + 24, + 220, + 32, + 183, + 0, + 19, + 5, + 104, + 101, + 108, + 108, + 111, + ], ] # manual code cov test_vectors_manual = [ # inconsistent between ed25519 and secp256k1 - [ 0 ], # ed25519: err, secp256k1: ok - [ 0, 0 ], # ed25519: ok, secp256k1: err - [ 0, 2 ], # ed25519: ok, secp256k1: err + [0], # ed25519: err, secp256k1: ok + [0, 0], # ed25519: ok, secp256k1: err + [0, 2], # ed25519: ok, secp256k1: err # InvalidInstructionDataSize (result: 5) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L90-L92 - [ 1 ], + [1], # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L94-L96 - [ 0, 0, 0 ], + [0, 0, 0], # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L101-L103 - [ 1, 0, 0 ], - + [1, 0, 0], # InvalidDataOffsets (result: 4) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L111-L112 # ??? # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L115-L121 # tested above - # InvalidSignature (result: 3) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L123-L124 # signature fails to decode - [1, 0, 48, 0, 255, 255, 16, 0, 255, 255, 112, 0, 5, 0, 255, 255, 77, 24, 168, 156, 166, 0, 87, 128, 189, 248, 212, 58, 28, 154, 34, 186, 179, 37, 7, 189, 36, 105, 135, 255, 37, 58, 68, 162, 199, 239, 98, 214, 47, 43, 230, 141, 139, 231, 170, 75, 55, 76, 78, 200, 97, 43, 17, 24, 225, 143, 160, 169, 12, 27, 16, 219, 4, 218, 114, 30, 149, 132, 33, 178, 94, 40, 150, 10, 243, 203, 248, 194, 243, 66, 51, 212, 101, 196, 7, 121, 101, 161, 171, 161, 88, 6, 129, 191, 191, 157, 230, 170, 180, 16, 67, 255, 104, 101, 108, 108, 111], - + [ + 1, + 0, + 48, + 0, + 255, + 255, + 16, + 0, + 255, + 255, + 112, + 0, + 5, + 0, + 255, + 255, + 77, + 24, + 168, + 156, + 166, + 0, + 87, + 128, + 189, + 248, + 212, + 58, + 28, + 154, + 34, + 186, + 179, + 37, + 7, + 189, + 36, + 105, + 135, + 255, + 37, + 58, + 68, + 162, + 199, + 239, + 98, + 214, + 47, + 43, + 230, + 141, + 139, + 231, + 170, + 75, + 55, + 76, + 78, + 200, + 97, + 43, + 17, + 24, + 225, + 143, + 160, + 169, + 12, + 27, + 16, + 219, + 4, + 218, + 114, + 30, + 149, + 132, + 33, + 178, + 94, + 40, + 150, + 10, + 243, + 203, + 248, + 194, + 243, + 66, + 51, + 212, + 101, + 196, + 7, + 121, + 101, + 161, + 171, + 161, + 88, + 6, + 129, + 191, + 191, + 157, + 230, + 170, + 180, + 16, + 67, + 255, + 104, + 101, + 108, + 108, + 111, + ], # InvalidDataOffsets (result: 4) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L127-L133 # tested above - # InvalidPublicKey (result: 1) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L135-L136 - [1, 0, 48, 0, 255, 255, 16, 0, 255, 255, 112, 0, 5, 0, 255, 255, 88, 24, 168, 156, 166, 0, 87, 128, 189, 248, 212, 58, 28, 154, 34, 186, 179, 37, 7, 189, 36, 105, 135, 255, 37, 58, 68, 162, 199, 239, 98, 214, 47, 43, 230, 141, 139, 231, 170, 75, 55, 76, 78, 200, 97, 43, 17, 24, 225, 143, 160, 169, 12, 27, 16, 219, 4, 218, 114, 30, 149, 132, 33, 178, 94, 40, 150, 10, 243, 203, 248, 194, 243, 66, 51, 212, 101, 196, 7, 121, 101, 161, 171, 161, 88, 6, 129, 191, 191, 157, 230, 170, 180, 16, 67, 9, 104, 101, 108, 108, 111], - + [ + 1, + 0, + 48, + 0, + 255, + 255, + 16, + 0, + 255, + 255, + 112, + 0, + 5, + 0, + 255, + 255, + 88, + 24, + 168, + 156, + 166, + 0, + 87, + 128, + 189, + 248, + 212, + 58, + 28, + 154, + 34, + 186, + 179, + 37, + 7, + 189, + 36, + 105, + 135, + 255, + 37, + 58, + 68, + 162, + 199, + 239, + 98, + 214, + 47, + 43, + 230, + 141, + 139, + 231, + 170, + 75, + 55, + 76, + 78, + 200, + 97, + 43, + 17, + 24, + 225, + 143, + 160, + 169, + 12, + 27, + 16, + 219, + 4, + 218, + 114, + 30, + 149, + 132, + 33, + 178, + 94, + 40, + 150, + 10, + 243, + 203, + 248, + 194, + 243, + 66, + 51, + 212, + 101, + 196, + 7, + 121, + 101, + 161, + 171, + 161, + 88, + 6, + 129, + 191, + 191, + 157, + 230, + 170, + 180, + 16, + 67, + 9, + 104, + 101, + 108, + 108, + 111, + ], # InvalidDataOffsets (result: 4) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L139-L145 # tested above - # InvalidSignature (result: 3) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/ed25519_instruction.rs#L147-L149 # signature fails to verify - [1, 0, 48, 0, 255, 255, 16, 0, 255, 255, 112, 0, 5, 0, 255, 255, 77, 24, 168, 156, 166, 0, 87, 128, 189, 248, 212, 58, 28, 154, 34, 186, 179, 37, 7, 189, 36, 105, 135, 255, 37, 58, 68, 162, 199, 239, 98, 214, 47, 43, 230, 141, 139, 231, 170, 75, 55, 76, 78, 200, 97, 43, 17, 24, 225, 143, 160, 169, 12, 27, 16, 219, 4, 218, 114, 30, 149, 132, 33, 178, 94, 40, 150, 10, 243, 203, 248, 194, 243, 66, 51, 212, 101, 196, 7, 121, 101, 161, 171, 161, 88, 6, 129, 191, 191, 157, 230, 170, 180, 16, 67, 16, 104, 101, 108, 108, 111], - [2, 0, 62, 0, 255, 255, 30, 0, 255, 255, 126, 0, 5, 0, 255, 255, - 163, 0, 255, 255, 131, 0, 255, 255, 227, 0, 5, 0, 255, 255, - 77, 24, 168, 156, 166, 0, 87, 128, 189, 248, 212, 58, 28, 154, 34, 186, 179, 37, 7, 189, 36, 105, 135, 255, 37, 58, 68, 162, 199, 239, 98, 214, 47, 43, 230, 141, 139, 231, 170, 75, 55, 76, 78, 200, 97, 43, 17, 24, 225, 143, 160, 169, 12, 27, 16, 219, 4, 218, 114, 30, 149, 132, 33, 178, 94, 40, 150, 10, 243, 203, 248, 194, 243, 66, 51, 212, 101, 196, 7, 121, 101, 161, 171, 161, 88, 6, 129, 191, 191, 157, 230, 170, 180, 16, 67, 9, 104, 101, 108, 108, 111, - 75, 214, 129, 151, 244, 149, 70, 192, 102, 135, 224, 99, 199, 172, 238, 204, 3, 67, 253, 92, 104, 212, 24, 116, 243, 199, 49, 42, 20, 156, 143, 83, 1, 148, 145, 203, 46, 109, 182, 75, 135, 218, 65, 3, 176, 77, 9, 53, 33, 86, 42, 178, 80, 169, 11, 169, 251, 61, 180, 51, 167, 39, 34, 189, 140, 51, 151, 209, 50, 76, 167, 90, 205, 1, 57, 197, 149, 97, 99, 241, 191, 66, 222, 90, 0, 251, 220, 145, 101, 24, 220, 32, 183, 0, 19, 16, 104, 101, 108, 108, 111], - + [ + 1, + 0, + 48, + 0, + 255, + 255, + 16, + 0, + 255, + 255, + 112, + 0, + 5, + 0, + 255, + 255, + 77, + 24, + 168, + 156, + 166, + 0, + 87, + 128, + 189, + 248, + 212, + 58, + 28, + 154, + 34, + 186, + 179, + 37, + 7, + 189, + 36, + 105, + 135, + 255, + 37, + 58, + 68, + 162, + 199, + 239, + 98, + 214, + 47, + 43, + 230, + 141, + 139, + 231, + 170, + 75, + 55, + 76, + 78, + 200, + 97, + 43, + 17, + 24, + 225, + 143, + 160, + 169, + 12, + 27, + 16, + 219, + 4, + 218, + 114, + 30, + 149, + 132, + 33, + 178, + 94, + 40, + 150, + 10, + 243, + 203, + 248, + 194, + 243, + 66, + 51, + 212, + 101, + 196, + 7, + 121, + 101, + 161, + 171, + 161, + 88, + 6, + 129, + 191, + 191, + 157, + 230, + 170, + 180, + 16, + 67, + 16, + 104, + 101, + 108, + 108, + 111, + ], + [ + 2, + 0, + 62, + 0, + 255, + 255, + 30, + 0, + 255, + 255, + 126, + 0, + 5, + 0, + 255, + 255, + 163, + 0, + 255, + 255, + 131, + 0, + 255, + 255, + 227, + 0, + 5, + 0, + 255, + 255, + 77, + 24, + 168, + 156, + 166, + 0, + 87, + 128, + 189, + 248, + 212, + 58, + 28, + 154, + 34, + 186, + 179, + 37, + 7, + 189, + 36, + 105, + 135, + 255, + 37, + 58, + 68, + 162, + 199, + 239, + 98, + 214, + 47, + 43, + 230, + 141, + 139, + 231, + 170, + 75, + 55, + 76, + 78, + 200, + 97, + 43, + 17, + 24, + 225, + 143, + 160, + 169, + 12, + 27, + 16, + 219, + 4, + 218, + 114, + 30, + 149, + 132, + 33, + 178, + 94, + 40, + 150, + 10, + 243, + 203, + 248, + 194, + 243, + 66, + 51, + 212, + 101, + 196, + 7, + 121, + 101, + 161, + 171, + 161, + 88, + 6, + 129, + 191, + 191, + 157, + 230, + 170, + 180, + 16, + 67, + 9, + 104, + 101, + 108, + 108, + 111, + 75, + 214, + 129, + 151, + 244, + 149, + 70, + 192, + 102, + 135, + 224, + 99, + 199, + 172, + 238, + 204, + 3, + 67, + 253, + 92, + 104, + 212, + 24, + 116, + 243, + 199, + 49, + 42, + 20, + 156, + 143, + 83, + 1, + 148, + 145, + 203, + 46, + 109, + 182, + 75, + 135, + 218, + 65, + 3, + 176, + 77, + 9, + 53, + 33, + 86, + 42, + 178, + 80, + 169, + 11, + 169, + 251, + 61, + 180, + 51, + 167, + 39, + 34, + 189, + 140, + 51, + 151, + 209, + 50, + 76, + 167, + 90, + 205, + 1, + 57, + 197, + 149, + 97, + 99, + 241, + 191, + 66, + 222, + 90, + 0, + 251, + 220, + 145, + 101, + 24, + 220, + 32, + 183, + 0, + 19, + 16, + 104, + 101, + 108, + 108, + 111, + ], # Ok() # valid - [1, 0, 48, 0, 255, 255, 16, 0, 255, 255, 112, 0, 5, 0, 255, 255, 77, 24, 168, 156, 166, 0, 87, 128, 189, 248, 212, 58, 28, 154, 34, 186, 179, 37, 7, 189, 36, 105, 135, 255, 37, 58, 68, 162, 199, 239, 98, 214, 47, 43, 230, 141, 139, 231, 170, 75, 55, 76, 78, 200, 97, 43, 17, 24, 225, 143, 160, 169, 12, 27, 16, 219, 4, 218, 114, 30, 149, 132, 33, 178, 94, 40, 150, 10, 243, 203, 248, 194, 243, 66, 51, 212, 101, 196, 7, 121, 101, 161, 171, 161, 88, 6, 129, 191, 191, 157, 230, 170, 180, 16, 67, 9, 104, 101, 108, 108, 111], + [ + 1, + 0, + 48, + 0, + 255, + 255, + 16, + 0, + 255, + 255, + 112, + 0, + 5, + 0, + 255, + 255, + 77, + 24, + 168, + 156, + 166, + 0, + 87, + 128, + 189, + 248, + 212, + 58, + 28, + 154, + 34, + 186, + 179, + 37, + 7, + 189, + 36, + 105, + 135, + 255, + 37, + 58, + 68, + 162, + 199, + 239, + 98, + 214, + 47, + 43, + 230, + 141, + 139, + 231, + 170, + 75, + 55, + 76, + 78, + 200, + 97, + 43, + 17, + 24, + 225, + 143, + 160, + 169, + 12, + 27, + 16, + 219, + 4, + 218, + 114, + 30, + 149, + 132, + 33, + 178, + 94, + 40, + 150, + 10, + 243, + 203, + 248, + 194, + 243, + 66, + 51, + 212, + 101, + 196, + 7, + 121, + 101, + 161, + 171, + 161, + 88, + 6, + 129, + 191, + 191, + 157, + 230, + 170, + 180, + 16, + 67, + 9, + 104, + 101, + 108, + 108, + 111, + ], # valid (add 14 to offsets, dupe the struct) - [2, 0, 62, 0, 255, 255, 30, 0, 255, 255, 126, 0, 5, 0, 255, 255, - 62, 0, 255, 255, 30, 0, 255, 255, 126, 0, 5, 0, 255, 255, 77, 24, 168, 156, 166, 0, 87, 128, 189, 248, 212, 58, 28, 154, 34, 186, 179, 37, 7, 189, 36, 105, 135, 255, 37, 58, 68, 162, 199, 239, 98, 214, 47, 43, 230, 141, 139, 231, 170, 75, 55, 76, 78, 200, 97, 43, 17, 24, 225, 143, 160, 169, 12, 27, 16, 219, 4, 218, 114, 30, 149, 132, 33, 178, 94, 40, 150, 10, 243, 203, 248, 194, 243, 66, 51, 212, 101, 196, 7, 121, 101, 161, 171, 161, 88, 6, 129, 191, 191, 157, 230, 170, 180, 16, 67, 9, 104, 101, 108, 108, 111], + [ + 2, + 0, + 62, + 0, + 255, + 255, + 30, + 0, + 255, + 255, + 126, + 0, + 5, + 0, + 255, + 255, + 62, + 0, + 255, + 255, + 30, + 0, + 255, + 255, + 126, + 0, + 5, + 0, + 255, + 255, + 77, + 24, + 168, + 156, + 166, + 0, + 87, + 128, + 189, + 248, + 212, + 58, + 28, + 154, + 34, + 186, + 179, + 37, + 7, + 189, + 36, + 105, + 135, + 255, + 37, + 58, + 68, + 162, + 199, + 239, + 98, + 214, + 47, + 43, + 230, + 141, + 139, + 231, + 170, + 75, + 55, + 76, + 78, + 200, + 97, + 43, + 17, + 24, + 225, + 143, + 160, + 169, + 12, + 27, + 16, + 219, + 4, + 218, + 114, + 30, + 149, + 132, + 33, + 178, + 94, + 40, + 150, + 10, + 243, + 203, + 248, + 194, + 243, + 66, + 51, + 212, + 101, + 196, + 7, + 121, + 101, + 161, + 171, + 161, + 88, + 6, + 129, + 191, + 191, + 157, + 230, + 170, + 180, + 16, + 67, + 9, + 104, + 101, + 108, + 108, + 111, + ], # 2 valid - [2, 0, 62, 0, 255, 255, 30, 0, 255, 255, 126, 0, 5, 0, 255, 255, - 163, 0, 255, 255, 131, 0, 255, 255, 227, 0, 5, 0, 255, 255, - 77, 24, 168, 156, 166, 0, 87, 128, 189, 248, 212, 58, 28, 154, 34, 186, 179, 37, 7, 189, 36, 105, 135, 255, 37, 58, 68, 162, 199, 239, 98, 214, 47, 43, 230, 141, 139, 231, 170, 75, 55, 76, 78, 200, 97, 43, 17, 24, 225, 143, 160, 169, 12, 27, 16, 219, 4, 218, 114, 30, 149, 132, 33, 178, 94, 40, 150, 10, 243, 203, 248, 194, 243, 66, 51, 212, 101, 196, 7, 121, 101, 161, 171, 161, 88, 6, 129, 191, 191, 157, 230, 170, 180, 16, 67, 9, 104, 101, 108, 108, 111, - 75, 214, 129, 151, 244, 149, 70, 192, 102, 135, 224, 99, 199, 172, 238, 204, 3, 67, 253, 92, 104, 212, 24, 116, 243, 199, 49, 42, 20, 156, 143, 83, 1, 148, 145, 203, 46, 109, 182, 75, 135, 218, 65, 3, 176, 77, 9, 53, 33, 86, 42, 178, 80, 169, 11, 169, 251, 61, 180, 51, 167, 39, 34, 189, 140, 51, 151, 209, 50, 76, 167, 90, 205, 1, 57, 197, 149, 97, 99, 241, 191, 66, 222, 90, 0, 251, 220, 145, 101, 24, 220, 32, 183, 0, 19, 5, 104, 101, 108, 108, 111], + [ + 2, + 0, + 62, + 0, + 255, + 255, + 30, + 0, + 255, + 255, + 126, + 0, + 5, + 0, + 255, + 255, + 163, + 0, + 255, + 255, + 131, + 0, + 255, + 255, + 227, + 0, + 5, + 0, + 255, + 255, + 77, + 24, + 168, + 156, + 166, + 0, + 87, + 128, + 189, + 248, + 212, + 58, + 28, + 154, + 34, + 186, + 179, + 37, + 7, + 189, + 36, + 105, + 135, + 255, + 37, + 58, + 68, + 162, + 199, + 239, + 98, + 214, + 47, + 43, + 230, + 141, + 139, + 231, + 170, + 75, + 55, + 76, + 78, + 200, + 97, + 43, + 17, + 24, + 225, + 143, + 160, + 169, + 12, + 27, + 16, + 219, + 4, + 218, + 114, + 30, + 149, + 132, + 33, + 178, + 94, + 40, + 150, + 10, + 243, + 203, + 248, + 194, + 243, + 66, + 51, + 212, + 101, + 196, + 7, + 121, + 101, + 161, + 171, + 161, + 88, + 6, + 129, + 191, + 191, + 157, + 230, + 170, + 180, + 16, + 67, + 9, + 104, + 101, + 108, + 108, + 111, + 75, + 214, + 129, + 151, + 244, + 149, + 70, + 192, + 102, + 135, + 224, + 99, + 199, + 172, + 238, + 204, + 3, + 67, + 253, + 92, + 104, + 212, + 24, + 116, + 243, + 199, + 49, + 42, + 20, + 156, + 143, + 83, + 1, + 148, + 145, + 203, + 46, + 109, + 182, + 75, + 135, + 218, + 65, + 3, + 176, + 77, + 9, + 53, + 33, + 86, + 42, + 178, + 80, + 169, + 11, + 169, + 251, + 61, + 180, + 51, + 167, + 39, + 34, + 189, + 140, + 51, + 151, + 209, + 50, + 76, + 167, + 90, + 205, + 1, + 57, + 197, + 149, + 97, + 99, + 241, + 191, + 66, + 222, + 90, + 0, + 251, + 220, + 145, + 101, + 24, + 220, + 32, + 183, + 0, + 19, + 5, + 104, + 101, + 108, + 108, + 111, + ], ] + # test vectors from wycheproofs and cctv @dataclass class EddsaVerify: @@ -104,6 +1398,7 @@ class EddsaVerify: ok: bool strict: bool + def wycheproofs_ed25519(): req = requests.get( "https://raw.githubusercontent.com/google/wycheproof/master/testvectors/eddsa_test.json" @@ -132,6 +1427,7 @@ def wycheproofs_ed25519(): ) return verify_tests + def cctv_ed25519(): req = requests.get( "https://raw.githubusercontent.com/C2SP/CCTV/main/ed25519/ed25519vectors.json" @@ -143,8 +1439,22 @@ def cctv_ed25519(): flags = test["flags"] if flags: set_flags = set(flags) - ok = (set_flags - set(["low_order_A", "low_order_R", "non_canonical_A", "low_order_component_A", "low_order_component_R", "reencoded_k"])) == set() - strict = (set_flags - set(["low_order_component_A", "low_order_component_R"])) == set() + ok = ( + set_flags + - set( + [ + "low_order_A", + "low_order_R", + "non_canonical_A", + "low_order_component_A", + "low_order_component_R", + "reencoded_k", + ] + ) + ) == set() + strict = ( + set_flags - set(["low_order_component_A", "low_order_component_R"]) + ) == set() if "non_canonical_R" in set_flags and "low_order_R" not in set_flags: raise Exception(test["number"]) else: @@ -154,7 +1464,7 @@ def cctv_ed25519(): EddsaVerify( tcId=test["number"], comment=test["msg"], - msg=bytes(test["msg"], 'utf-8'), + msg=bytes(test["msg"], "utf-8"), sig=bytes.fromhex(test["sig"]), pub=bytes.fromhex(test["key"]), ok=ok, # we implement dalek verify_strict, so all these should fail @@ -163,41 +1473,67 @@ def cctv_ed25519(): ) return verify_tests + def _into_instr_data(key_prefix, verify_tests): test_vectors = [] - prefix = [1, 0, 48, 0, 255, 255, 16, 0, 255, 255, 112, 0, ] + prefix = [ + 1, + 0, + 48, + 0, + 255, + 255, + 16, + 0, + 255, + 255, + 112, + 0, + ] for test in verify_tests: l = len(test.msg) - if l >= 1<<16: + if l >= 1 << 16: print("msg too long, skipping") continue - data = prefix + [l % 256, l >> 8, 255, 255] + list(test.pub) + list(test.sig) + list(test.msg) + data = ( + prefix + + [l % 256, l >> 8, 255, 255] + + list(test.pub) + + list(test.sig) + + list(test.msg) + ) key = key_prefix + str(test.tcId) test_vectors.append((key, data)) return test_vectors + def _into_key_data(key_prefix, test_vectors): return [(key_prefix + str(j), data) for j, data in enumerate(test_vectors)] + print("Generating ed25519 tests...") -test_vectors = _into_key_data("a", test_vectors_agave) \ - + _into_key_data("m", test_vectors_manual) \ - + _into_instr_data("w", wycheproofs_ed25519()) \ +test_vectors = ( + _into_key_data("a", test_vectors_agave) + + _into_key_data("m", test_vectors_manual) + + _into_instr_data("w", wycheproofs_ed25519()) + _into_instr_data("c", cctv_ed25519()) +) program_id = fd58.dec32(bytes(program_id, "utf-8")) -program_owner = fd58.dec32(bytes("NativeLoader1111111111111111111111111111111", "utf-8")) -for (key, test) in test_vectors: - instr_ctx = pb.InstrContext() +program_owner = fd58.dec32( + bytes("NativeLoader1111111111111111111111111111111", "utf-8") +) +for key, test in test_vectors: + instr_ctx = invoke_pb.InstrContext() instr_ctx.program_id = program_id instr_ctx.data = bytes(test) - account = pb.AcctState() + account = context_pb.AcctState() account.address = program_id account.owner = program_owner instr_ctx.accounts.extend([account]) - instr_ctx.instr_accounts.extend([pb.InstrAcct()]) + instr_ctx.instr_accounts.extend([invoke_pb.InstrAcct()]) serialized_instr = instr_ctx.SerializeToString(deterministic=True) filename = str(key) + "_" + hashlib.sha3_256(serialized_instr).hexdigest()[:16] diff --git a/generators/secp256k1.py b/generators/secp256k1.py index 0feeda0..47bbf83 100644 --- a/generators/secp256k1.py +++ b/generators/secp256k1.py @@ -1,7 +1,8 @@ import fd58 import hashlib from eth_hash.auto import keccak -import test_suite.invoke_pb2 as pb +import test_suite.invoke_pb2 as invoke_pb +import test_suite.context_pb2 as context_pb from dataclasses import dataclass import requests @@ -16,9 +17,9 @@ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], # test_invalid_offsets [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0] + [ 0 ] * 100, - [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] + [ 0 ] * 100, - [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] + [ 0 ] * 100, + [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0] + [0] * 100, + [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] + [0] * 100, + [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] + [0] * 100, # test_signature_offset [1, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], @@ -31,19 +32,601 @@ [1, 0, 0, 0, 0, 0, 0, 100, 0, 232, 3, 0], [1, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0], # test_secp256k1 - [1, 32, 0, 0, 12, 0, 0, 97, 0, 5, 0, 0, 129, 246, 169, 169, 105, 76, 208, 128, 223, 135, 27, 68, 249, 42, 201, 69, 55, 2, 173, 101, 14, 196, 198, 193, 237, 0, 14, 83, 87, 183, 25, 69, 136, 43, 251, 73, 44, 194, 141, 230, 102, 16, 220, 6, 46, 214, 214, 125, 120, 16, 103, 254, 39, 121, 88, 223, 156, 229, 186, 211, 38, 101, 196, 233, 125, 150, 136, 177, 123, 197, 48, 219, 28, 26, 10, 76, 198, 127, 91, 80, 88, 191, 6, 3, 1, 104, 101, 108, 108, 111], - [1, 32, 12, 0, 12, 0, 0, 97, 0, 5, 0, 0, 129, 246, 169, 169, 105, 76, 208, 128, 223, 135, 27, 68, 249, 42, 201, 69, 55, 2, 173, 101, 14, 196, 198, 193, 237, 0, 14, 83, 87, 183, 25, 69, 136, 43, 251, 73, 44, 194, 141, 230, 102, 16, 220, 6, 46, 214, 214, 125, 120, 16, 103, 254, 39, 121, 88, 223, 156, 229, 186, 211, 38, 101, 196, 233, 125, 150, 136, 177, 123, 197, 48, 219, 28, 26, 10, 76, 198, 127, 91, 80, 88, 191, 6, 3, 1, 104, 101, 108, 108, 111], + [ + 1, + 32, + 0, + 0, + 12, + 0, + 0, + 97, + 0, + 5, + 0, + 0, + 129, + 246, + 169, + 169, + 105, + 76, + 208, + 128, + 223, + 135, + 27, + 68, + 249, + 42, + 201, + 69, + 55, + 2, + 173, + 101, + 14, + 196, + 198, + 193, + 237, + 0, + 14, + 83, + 87, + 183, + 25, + 69, + 136, + 43, + 251, + 73, + 44, + 194, + 141, + 230, + 102, + 16, + 220, + 6, + 46, + 214, + 214, + 125, + 120, + 16, + 103, + 254, + 39, + 121, + 88, + 223, + 156, + 229, + 186, + 211, + 38, + 101, + 196, + 233, + 125, + 150, + 136, + 177, + 123, + 197, + 48, + 219, + 28, + 26, + 10, + 76, + 198, + 127, + 91, + 80, + 88, + 191, + 6, + 3, + 1, + 104, + 101, + 108, + 108, + 111, + ], + [ + 1, + 32, + 12, + 0, + 12, + 0, + 0, + 97, + 0, + 5, + 0, + 0, + 129, + 246, + 169, + 169, + 105, + 76, + 208, + 128, + 223, + 135, + 27, + 68, + 249, + 42, + 201, + 69, + 55, + 2, + 173, + 101, + 14, + 196, + 198, + 193, + 237, + 0, + 14, + 83, + 87, + 183, + 25, + 69, + 136, + 43, + 251, + 73, + 44, + 194, + 141, + 230, + 102, + 16, + 220, + 6, + 46, + 214, + 214, + 125, + 120, + 16, + 103, + 254, + 39, + 121, + 88, + 223, + 156, + 229, + 186, + 211, + 38, + 101, + 196, + 233, + 125, + 150, + 136, + 177, + 123, + 197, + 48, + 219, + 28, + 26, + 10, + 76, + 198, + 127, + 91, + 80, + 88, + 191, + 6, + 3, + 1, + 104, + 101, + 108, + 108, + 111, + ], # test_malleability - [2, 23, 0, 0, 88, 0, 0, 108, 0, 5, 0, 0, 113, 0, 0, 178, 0, 0, 198, 0, 5, 0, 0, 8, 106, 2, 17, 228, 135, 168, 210, 219, 113, 75, 102, 239, 51, 218, 230, 218, 125, 149, 73, 201, 61, 102, 253, 170, 115, 201, 14, 162, 243, 11, 22, 90, 90, 242, 118, 196, 38, 97, 5, 74, 132, 110, 172, 168, 204, 248, 224, 162, 249, 64, 95, 48, 88, 72, 56, 157, 16, 4, 2, 165, 47, 207, 113, 0, 45, 237, 4, 121, 189, 201, 77, 37, 225, 171, 23, 82, 196, 28, 174, 59, 124, 136, 139, 245, 104, 101, 108, 108, 111, 8, 106, 2, 17, 228, 135, 168, 210, 219, 113, 75, 102, 239, 51, 218, 230, 218, 125, 149, 73, 201, 61, 102, 253, 170, 115, 201, 14, 162, 243, 11, 22, 165, 165, 13, 137, 59, 217, 158, 250, 181, 123, 145, 83, 87, 51, 7, 30, 23, 181, 156, 135, 126, 240, 88, 3, 34, 194, 90, 138, 43, 6, 113, 208, 1, 45, 237, 4, 121, 189, 201, 77, 37, 225, 171, 23, 82, 196, 28, 174, 59, 124, 136, 139, 245, 104, 101, 108, 108, 111], + [ + 2, + 23, + 0, + 0, + 88, + 0, + 0, + 108, + 0, + 5, + 0, + 0, + 113, + 0, + 0, + 178, + 0, + 0, + 198, + 0, + 5, + 0, + 0, + 8, + 106, + 2, + 17, + 228, + 135, + 168, + 210, + 219, + 113, + 75, + 102, + 239, + 51, + 218, + 230, + 218, + 125, + 149, + 73, + 201, + 61, + 102, + 253, + 170, + 115, + 201, + 14, + 162, + 243, + 11, + 22, + 90, + 90, + 242, + 118, + 196, + 38, + 97, + 5, + 74, + 132, + 110, + 172, + 168, + 204, + 248, + 224, + 162, + 249, + 64, + 95, + 48, + 88, + 72, + 56, + 157, + 16, + 4, + 2, + 165, + 47, + 207, + 113, + 0, + 45, + 237, + 4, + 121, + 189, + 201, + 77, + 37, + 225, + 171, + 23, + 82, + 196, + 28, + 174, + 59, + 124, + 136, + 139, + 245, + 104, + 101, + 108, + 108, + 111, + 8, + 106, + 2, + 17, + 228, + 135, + 168, + 210, + 219, + 113, + 75, + 102, + 239, + 51, + 218, + 230, + 218, + 125, + 149, + 73, + 201, + 61, + 102, + 253, + 170, + 115, + 201, + 14, + 162, + 243, + 11, + 22, + 165, + 165, + 13, + 137, + 59, + 217, + 158, + 250, + 181, + 123, + 145, + 83, + 87, + 51, + 7, + 30, + 23, + 181, + 156, + 135, + 126, + 240, + 88, + 3, + 34, + 194, + 90, + 138, + 43, + 6, + 113, + 208, + 1, + 45, + 237, + 4, + 121, + 189, + 201, + 77, + 37, + 225, + 171, + 23, + 82, + 196, + 28, + 174, + 59, + 124, + 136, + 139, + 245, + 104, + 101, + 108, + 108, + 111, + ], ] -prefix = [1, 32, 0, 0, 12, 0, 0, 97, 0, 5, 0, 0] +prefix = [1, 32, 0, 0, 12, 0, 0, 97, 0, 5, 0, 0] prefix_alt = [1, 37, 0, 0, 12, 0, 0, 32, 0, 5, 0, 0] ## swap sig, msg -pubkey = [129, 246, 169, 169, 105, 76, 208, 128, 223, 135, 27, 68, 249, 42, 201, 69, 55, 2, 173, 101] -pubkey_err = [111, 246, 169, 169, 105, 76, 208, 128, 223, 135, 27, 68, 249, 42, 201, 69, 55, 2, 173, 101] -sig = [14, 196, 198, 193, 237, 0, 14, 83, 87, 183, 25, 69, 136, 43, 251, 73, 44, 194, 141, 230, 102, 16, 220, 6, 46, 214, 214, 125, 120, 16, 103, 254, 39, 121, 88, 223, 156, 229, 186, 211, 38, 101, 196, 233, 125, 150, 136, 177, 123, 197, 48, 219, 28, 26, 10, 76, 198, 127, 91, 80, 88, 191, 6, 3] -sig_invalid = [255]*64 -sig_err = [14, 196, 198, 193, 237, 0, 14, 255, 87, 183, 25, 69, 136, 43, 251, 73, 44, 194, 141, 230, 102, 16, 220, 6, 46, 214, 214, 125, 120, 16, 103, 254, 39, 121, 88, 223, 156, 229, 186, 211, 38, 101, 196, 233, 125, 150, 136, 177, 123, 197, 48, 219, 28, 26, 10, 76, 198, 127, 91, 80, 88, 191, 6, 3] +pubkey = [ + 129, + 246, + 169, + 169, + 105, + 76, + 208, + 128, + 223, + 135, + 27, + 68, + 249, + 42, + 201, + 69, + 55, + 2, + 173, + 101, +] +pubkey_err = [ + 111, + 246, + 169, + 169, + 105, + 76, + 208, + 128, + 223, + 135, + 27, + 68, + 249, + 42, + 201, + 69, + 55, + 2, + 173, + 101, +] +sig = [ + 14, + 196, + 198, + 193, + 237, + 0, + 14, + 83, + 87, + 183, + 25, + 69, + 136, + 43, + 251, + 73, + 44, + 194, + 141, + 230, + 102, + 16, + 220, + 6, + 46, + 214, + 214, + 125, + 120, + 16, + 103, + 254, + 39, + 121, + 88, + 223, + 156, + 229, + 186, + 211, + 38, + 101, + 196, + 233, + 125, + 150, + 136, + 177, + 123, + 197, + 48, + 219, + 28, + 26, + 10, + 76, + 198, + 127, + 91, + 80, + 88, + 191, + 6, + 3, +] +sig_invalid = [255] * 64 +sig_err = [ + 14, + 196, + 198, + 193, + 237, + 0, + 14, + 255, + 87, + 183, + 25, + 69, + 136, + 43, + 251, + 73, + 44, + 194, + 141, + 230, + 102, + 16, + 220, + 6, + 46, + 214, + 214, + 125, + 120, + 16, + 103, + 254, + 39, + 121, + 88, + 223, + 156, + 229, + 186, + 211, + 38, + 101, + 196, + 233, + 125, + 150, + 136, + 177, + 123, + 197, + 48, + 219, + 28, + 26, + 10, + 76, + 198, + 127, + 91, + 80, + 88, + 191, + 6, + 3, +] # ^^^ modified byte recid = 1 msg = [104, 101, 108, 108, 111] # hello @@ -51,79 +634,590 @@ # manual code cov test_vectors_manual = [ # inconsistent between ed25519 and secp256k1 - [ 0 ], # ed25519: err, secp256k1: ok - [ 0, 0 ], # ed25519: ok, secp256k1: err - [ 0, 2 ], # ed25519: ok, secp256k1: err + [0], # ed25519: err, secp256k1: ok + [0, 0], # ed25519: ok, secp256k1: err + [0, 2], # ed25519: ok, secp256k1: err # InvalidInstructionDataSize (result: 5) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L937-L947 # note: this is different behavior than ed25519 [], - [ 0, 0, 0 ], - + [0, 0, 0], # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L951-L953 - [ 1 ], - [ 1, 0, 0 ], - + [1], + [1, 0, 0], # InvalidSignature (result: 3) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L960-L961 # ??? I don't think this can ever happen? - # InvalidDataOffsets (result: 4) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L965-L967 # tested above - # InvalidSignature (result: 3) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L971-L973 # tested above # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L975-L978 # signature fails to decode - [1, 32, 0, 0, 12, 0, 0, 97, 0, 5, 0, 0, 129, 246, 169, 169, 105, 76, 208, 128, 223, 135, 27, 68, 249, 42, 201, 69, 55, 2, 173, 101, 255, 196, 198, 193, 237, 0, 14, 83, 87, 183, 25, 69, 136, 43, 251, 73, 44, 194, 141, 230, 102, 16, 220, 6, 46, 214, 214, 125, 120, 16, 103, 254, 39, 121, 88, 223, 156, 229, 186, 211, 38, 101, 196, 233, 125, 150, 136, 177, 123, 197, 48, 219, 28, 26, 10, 76, 198, 127, 91, 80, 88, 191, 6, 3, 1, 104, 101, 108, 108, 111], + [ + 1, + 32, + 0, + 0, + 12, + 0, + 0, + 97, + 0, + 5, + 0, + 0, + 129, + 246, + 169, + 169, + 105, + 76, + 208, + 128, + 223, + 135, + 27, + 68, + 249, + 42, + 201, + 69, + 55, + 2, + 173, + 101, + 255, + 196, + 198, + 193, + 237, + 0, + 14, + 83, + 87, + 183, + 25, + 69, + 136, + 43, + 251, + 73, + 44, + 194, + 141, + 230, + 102, + 16, + 220, + 6, + 46, + 214, + 214, + 125, + 120, + 16, + 103, + 254, + 39, + 121, + 88, + 223, + 156, + 229, + 186, + 211, + 38, + 101, + 196, + 233, + 125, + 150, + 136, + 177, + 123, + 197, + 48, + 219, + 28, + 26, + 10, + 76, + 198, + 127, + 91, + 80, + 88, + 191, + 6, + 3, + 1, + 104, + 101, + 108, + 108, + 111, + ], # \--- pubkey (eth) ---/ \--- sig ---/ \--- msg ---/ - # InvalidRecoveryId (result: 2) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L981C43-L981C60 prefix + pubkey + sig + [4] + msg, prefix_alt + pubkey + msg + sig + [4], prefix_alt + pubkey + msg + sig, - # InvalidDataOffsets (result: 4) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L984-L989 # tested above # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L992-L997 # tested above - # InvalidSignature (result: 3) # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L1003-L1008 # signature fails to verify - [1, 32, 0, 0, 12, 0, 0, 97, 0, 5, 0, 0, 129, 246, 169, 169, 105, 76, 208, 128, 223, 135, 27, 68, 249, 42, 201, 69, 55, 2, 173, 101, 14, 196, 198, 193, 237, 0, 14, 83, 87, 183, 25, 69, 136, 43, 251, 73, 44, 194, 141, 230, 102, 16, 220, 6, 46, 214, 214, 125, 120, 16, 103, 254, 39, 121, 88, 223, 156, 229, 186, 211, 38, 101, 196, 233, 125, 150, 136, 177, 123, 197, 48, 219, 28, 26, 10, 76, 198, 127, 91, 80, 88, 191, 6, 3, 1, 104, 101, 108, 108, 255], - [2, 23, 0, 0, 88, 0, 0, 108, 0, 5, 0, 0, 113, 0, 0, 178, 0, 0, 198, 0, 5, 0, 0, 8, 106, 2, 17, 228, 135, 168, 210, 219, 113, 75, 102, 239, 51, 218, 230, 218, 125, 149, 73, 201, 61, 102, 253, 170, 115, 201, 14, 162, 243, 11, 22, 90, 90, 242, 118, 196, 38, 97, 5, 74, 132, 110, 172, 168, 204, 248, 224, 162, 249, 64, 95, 48, 88, 72, 56, 157, 16, 4, 2, 165, 47, 207, 113, 0, 45, 237, 4, 121, 189, 201, 77, 37, 225, 171, 23, 82, 196, 28, 174, 59, 124, 136, 139, 245, 104, 101, 108, 108, 111, 8, 106, 2, 17, 228, 135, 168, 210, 219, 113, 75, 102, 239, 51, 218, 230, 218, 125, 149, 73, 201, 61, 102, 253, 170, 115, 201, 14, 162, 243, 11, 22, 165, 165, 13, 137, 59, 217, 158, 250, 181, 123, 145, 83, 87, 51, 7, 30, 23, 181, 156, 135, 126, 240, 88, 3, 34, 194, 90, 138, 43, 6, 113, 208, 1, 45, 237, 4, 121, 189, 201, 77, 37, 225, 171, 23, 82, 196, 28, 174, 59, 124, 136, 139, 245, 104, 101, 108, 108, 255], + [ + 1, + 32, + 0, + 0, + 12, + 0, + 0, + 97, + 0, + 5, + 0, + 0, + 129, + 246, + 169, + 169, + 105, + 76, + 208, + 128, + 223, + 135, + 27, + 68, + 249, + 42, + 201, + 69, + 55, + 2, + 173, + 101, + 14, + 196, + 198, + 193, + 237, + 0, + 14, + 83, + 87, + 183, + 25, + 69, + 136, + 43, + 251, + 73, + 44, + 194, + 141, + 230, + 102, + 16, + 220, + 6, + 46, + 214, + 214, + 125, + 120, + 16, + 103, + 254, + 39, + 121, + 88, + 223, + 156, + 229, + 186, + 211, + 38, + 101, + 196, + 233, + 125, + 150, + 136, + 177, + 123, + 197, + 48, + 219, + 28, + 26, + 10, + 76, + 198, + 127, + 91, + 80, + 88, + 191, + 6, + 3, + 1, + 104, + 101, + 108, + 108, + 255, + ], + [ + 2, + 23, + 0, + 0, + 88, + 0, + 0, + 108, + 0, + 5, + 0, + 0, + 113, + 0, + 0, + 178, + 0, + 0, + 198, + 0, + 5, + 0, + 0, + 8, + 106, + 2, + 17, + 228, + 135, + 168, + 210, + 219, + 113, + 75, + 102, + 239, + 51, + 218, + 230, + 218, + 125, + 149, + 73, + 201, + 61, + 102, + 253, + 170, + 115, + 201, + 14, + 162, + 243, + 11, + 22, + 90, + 90, + 242, + 118, + 196, + 38, + 97, + 5, + 74, + 132, + 110, + 172, + 168, + 204, + 248, + 224, + 162, + 249, + 64, + 95, + 48, + 88, + 72, + 56, + 157, + 16, + 4, + 2, + 165, + 47, + 207, + 113, + 0, + 45, + 237, + 4, + 121, + 189, + 201, + 77, + 37, + 225, + 171, + 23, + 82, + 196, + 28, + 174, + 59, + 124, + 136, + 139, + 245, + 104, + 101, + 108, + 108, + 111, + 8, + 106, + 2, + 17, + 228, + 135, + 168, + 210, + 219, + 113, + 75, + 102, + 239, + 51, + 218, + 230, + 218, + 125, + 149, + 73, + 201, + 61, + 102, + 253, + 170, + 115, + 201, + 14, + 162, + 243, + 11, + 22, + 165, + 165, + 13, + 137, + 59, + 217, + 158, + 250, + 181, + 123, + 145, + 83, + 87, + 51, + 7, + 30, + 23, + 181, + 156, + 135, + 126, + 240, + 88, + 3, + 34, + 194, + 90, + 138, + 43, + 6, + 113, + 208, + 1, + 45, + 237, + 4, + 121, + 189, + 201, + 77, + 37, + 225, + 171, + 23, + 82, + 196, + 28, + 174, + 59, + 124, + 136, + 139, + 245, + 104, + 101, + 108, + 108, + 255, + ], # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/src/secp256k1_instruction.rs#L1003-L1008 # sig returns incorrect pubkey - [1, 32, 0, 0, 12, 0, 0, 97, 0, 5, 0, 0, 111, 246, 169, 169, 105, 76, 208, 128, 223, 135, 27, 68, 249, 42, 201, 69, 55, 2, 173, 101, 14, 196, 198, 193, 237, 0, 14, 83, 87, 183, 25, 69, 136, 43, 251, 73, 44, 194, 141, 230, 102, 16, 220, 6, 46, 214, 214, 125, 120, 16, 103, 254, 39, 121, 88, 223, 156, 229, 186, 211, 38, 101, 196, 233, 125, 150, 136, 177, 123, 197, 48, 219, 28, 26, 10, 76, 198, 127, 91, 80, 88, 191, 6, 3, 1, 104, 101, 108, 108, 111], + [ + 1, + 32, + 0, + 0, + 12, + 0, + 0, + 97, + 0, + 5, + 0, + 0, + 111, + 246, + 169, + 169, + 105, + 76, + 208, + 128, + 223, + 135, + 27, + 68, + 249, + 42, + 201, + 69, + 55, + 2, + 173, + 101, + 14, + 196, + 198, + 193, + 237, + 0, + 14, + 83, + 87, + 183, + 25, + 69, + 136, + 43, + 251, + 73, + 44, + 194, + 141, + 230, + 102, + 16, + 220, + 6, + 46, + 214, + 214, + 125, + 120, + 16, + 103, + 254, + 39, + 121, + 88, + 223, + 156, + 229, + 186, + 211, + 38, + 101, + 196, + 233, + 125, + 150, + 136, + 177, + 123, + 197, + 48, + 219, + 28, + 26, + 10, + 76, + 198, + 127, + 91, + 80, + 88, + 191, + 6, + 3, + 1, + 104, + 101, + 108, + 108, + 111, + ], # \--- pubkey (eth) ---/ \--- sig ---/ \--- msg ---/ ] + def _into_key_data(key_prefix, test_vectors): return [(key_prefix + str(j), data) for j, data in enumerate(test_vectors)] + print("Generating secp256k1 tests...") -test_vectors = _into_key_data("a", test_vectors_agave) \ - + _into_key_data("m", test_vectors_manual) +test_vectors = _into_key_data("a", test_vectors_agave) + _into_key_data( + "m", test_vectors_manual +) program_id = fd58.dec32(bytes(program_id, "utf-8")) -program_owner = fd58.dec32(bytes("NativeLoader1111111111111111111111111111111", "utf-8")) -for (key, test) in test_vectors: - instr_ctx = pb.InstrContext() +program_owner = fd58.dec32( + bytes("NativeLoader1111111111111111111111111111111", "utf-8") +) +for key, test in test_vectors: + instr_ctx = invoke_pb.InstrContext() instr_ctx.program_id = program_id instr_ctx.data = bytes(test) - account = pb.AcctState() + account = context_pb.AcctState() account.address = program_id account.owner = program_owner instr_ctx.accounts.extend([account]) - instr_ctx.instr_accounts.extend([pb.InstrAcct()]) - instr_ctx.epoch_context.features.features.extend([0x1a6958db2ff09870]) + instr_ctx.instr_accounts.extend([invoke_pb.InstrAcct()]) + instr_ctx.epoch_context.features.features.extend([0x1A6958DB2FF09870]) serialized_instr = instr_ctx.SerializeToString(deterministic=True) filename = str(key) + "_" + hashlib.sha3_256(serialized_instr).hexdigest()[:16] diff --git a/generators/syscalls_alt_bn128.py b/generators/syscalls_alt_bn128.py index 4d54b2c..de37b2d 100644 --- a/generators/syscalls_alt_bn128.py +++ b/generators/syscalls_alt_bn128.py @@ -1,6 +1,6 @@ import base64 import hashlib -import test_suite.invoke_pb2 as pb +import test_suite.vm_pb2 as vm_pb OUTPUT_DIR = "./test-vectors/syscall/tests/alt_bn128" HEAP_START = 0x300000000 @@ -9,15 +9,15 @@ CU_MEM_OP = 10 ADD_OP = 0 -ADD_SZ = 64+64 +ADD_SZ = 64 + 64 ADD_CU = 334 MUL_OP = 2 -MUL_SZ = 64+32 +MUL_SZ = 64 + 32 MUL_CU = 3840 PAIRING_OP = 3 -PAIRING_SZ = (64+128)*2 +PAIRING_SZ = (64 + 128) * 2 PAIRING_CU = 36364 + 12121 + PAIRING_SZ + 85 + 32 # wtf!? COMP_G1_OP = 0 @@ -74,42 +74,46 @@ # xprint("neg_y_of_half_p_neg1", lift(-sqrt(half_p_neg1^3+3))) # annoying values -r = "30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001" -r_plus1 = "30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000002" -r_neg1 = "30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000" -half_r_plus1 = "183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f8000001" -half_r_neg1 = "183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f8000000" -ff = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" -three_f = "3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" -p = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47" -p_plus1 = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd48" -p_plus2 = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd49" -p_plus4 = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4b" -half_p_plus1 = "183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea4" -half_p_neg1 = "183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea3" -zero = "0000000000000000000000000000000000000000000000000000000000000000" -one = "0000000000000000000000000000000000000000000000000000000000000001" -two = "0000000000000000000000000000000000000000000000000000000000000002" -four = "0000000000000000000000000000000000000000000000000000000000000004" -sqrt_2 = "08c6d2adffacbc8438f09f321874ea66e2fcc29f8dcfec2caefa21ec8c96a408" -sqrt_11 = "0ce2c194b86251806451ec04be095d60517130cff61fcb49c4ef4e708dac7f34" -cbrt_neg2 = "2409ed9a7b7567337c6bfd3b97e9703c9deffb228c6c7324d8a447837238b15e" -neg_one = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd46" -neg_two = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd45" -neg_four = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd43" -neg_sqrt_2 = "279d7bc4e184e3a57f5fa684690c6df6b484a7f1daa1de608d266a2a4be6593f" -neg_sqrt_11 = "23818cde28cf4ea953fe59b1c377fafd461039c17251ff4377313da64ad07e13" -neg_cbrt_neg2 = "0c5a60d865bc38f63be4487ae997e820f9916f6edc055768637c449366444be9" -y_of_half_p_plus1 = "0af887597f97eba5472cc6fe9e9225009bbbf3477143e737dab8aa67afbc4d0a" -neg_y_of_half_p_plus1 = "256bc7196199b48471237eb7e2ef335cfbc57749f72de3556167e1af28c0b03d" -y_of_half_p_neg1 = "0a6ea289876b139cfe2cd1f08c065a2ab4aad542eaccb013520ea36934e877b4" -neg_y_of_half_p_neg1 = "25f5abe959c68c8cba2373c5f57afe32e2d6954e7da51a79ea11e8ada3948593" -threef_mod_p = "0f9bb18d1ece5fd647afba497e7ea7a2687e956e978e3572c3df73e9278302b8" -y_of_threef = "050627a03f77e36ba8541ff3e600a32a4792560aeb37454c810120db7063b653" -neg_y_of_threef = "2b5e26d2a1b9bcbe0ffc25c29b80b5334fef14867d3a8540bb1f6b3b681946f4" -x_of_p_plus1_half = "113568bcb08769c966ff32fc8d27c3d0bbaf342cdc318bddcbd287f8a5b99a52" -p_plus1_half = "183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea4" -neg_p_plus1_half = "183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea3" +r = "30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001" +r_plus1 = "30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000002" +r_neg1 = "30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000" +half_r_plus1 = "183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f8000001" +half_r_neg1 = "183227397098d014dc2822db40c0ac2e9419f4243cdcb848a1f0fac9f8000000" +ff = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" +three_f = "3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" +p = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47" +p_plus1 = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd48" +p_plus2 = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd49" +p_plus4 = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4b" +half_p_plus1 = "183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea4" +half_p_neg1 = "183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea3" +zero = "0000000000000000000000000000000000000000000000000000000000000000" +one = "0000000000000000000000000000000000000000000000000000000000000001" +two = "0000000000000000000000000000000000000000000000000000000000000002" +four = "0000000000000000000000000000000000000000000000000000000000000004" +sqrt_2 = "08c6d2adffacbc8438f09f321874ea66e2fcc29f8dcfec2caefa21ec8c96a408" +sqrt_11 = "0ce2c194b86251806451ec04be095d60517130cff61fcb49c4ef4e708dac7f34" +cbrt_neg2 = "2409ed9a7b7567337c6bfd3b97e9703c9deffb228c6c7324d8a447837238b15e" +neg_one = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd46" +neg_two = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd45" +neg_four = "30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd43" +neg_sqrt_2 = "279d7bc4e184e3a57f5fa684690c6df6b484a7f1daa1de608d266a2a4be6593f" +neg_sqrt_11 = "23818cde28cf4ea953fe59b1c377fafd461039c17251ff4377313da64ad07e13" +neg_cbrt_neg2 = "0c5a60d865bc38f63be4487ae997e820f9916f6edc055768637c449366444be9" +y_of_half_p_plus1 = "0af887597f97eba5472cc6fe9e9225009bbbf3477143e737dab8aa67afbc4d0a" +neg_y_of_half_p_plus1 = ( + "256bc7196199b48471237eb7e2ef335cfbc57749f72de3556167e1af28c0b03d" +) +y_of_half_p_neg1 = "0a6ea289876b139cfe2cd1f08c065a2ab4aad542eaccb013520ea36934e877b4" +neg_y_of_half_p_neg1 = ( + "25f5abe959c68c8cba2373c5f57afe32e2d6954e7da51a79ea11e8ada3948593" +) +threef_mod_p = "0f9bb18d1ece5fd647afba497e7ea7a2687e956e978e3572c3df73e9278302b8" +y_of_threef = "050627a03f77e36ba8541ff3e600a32a4792560aeb37454c810120db7063b653" +neg_y_of_threef = "2b5e26d2a1b9bcbe0ffc25c29b80b5334fef14867d3a8540bb1f6b3b681946f4" +x_of_p_plus1_half = "113568bcb08769c966ff32fc8d27c3d0bbaf342cdc318bddcbd287f8a5b99a52" +p_plus1_half = "183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea4" +neg_p_plus1_half = "183227397098d014dc2822db40c0ac2ecbc0b548b438e5469e10460b6c3e7ea3" annoying_scalars = [ # valid @@ -124,42 +128,43 @@ three_f, ff, ] -annoying_scalars = [ - base64.b16decode(scalar, True) for scalar in annoying_scalars -] +annoying_scalars = [base64.b16decode(scalar, True) for scalar in annoying_scalars] annoying_points = [ # there's no point with x=0 or y=0 # valid - [ zero, zero ], # point at infinity - [ one, two ], - [ one, neg_two ], - [ neg_one, sqrt_2 ], - [ neg_one, neg_sqrt_2 ], - [ two, sqrt_11 ], - [ two, neg_sqrt_11 ], - [ cbrt_neg2, one ], - [ cbrt_neg2, neg_one ], - [ half_p_plus1, y_of_half_p_plus1 ], - [ half_p_plus1, neg_y_of_half_p_plus1 ], - [ half_p_neg1, y_of_half_p_neg1 ], - [ half_p_neg1, neg_y_of_half_p_neg1 ], - [ threef_mod_p, y_of_threef ], - [ threef_mod_p, neg_y_of_threef ], - [ x_of_p_plus1_half, p_plus1_half ], # this is annoying because sqrt(.) = (p+1)/2 which is exactly at the cut off of neg vs pos - [ x_of_p_plus1_half, neg_p_plus1_half ], + [zero, zero], # point at infinity + [one, two], + [one, neg_two], + [neg_one, sqrt_2], + [neg_one, neg_sqrt_2], + [two, sqrt_11], + [two, neg_sqrt_11], + [cbrt_neg2, one], + [cbrt_neg2, neg_one], + [half_p_plus1, y_of_half_p_plus1], + [half_p_plus1, neg_y_of_half_p_plus1], + [half_p_neg1, y_of_half_p_neg1], + [half_p_neg1, neg_y_of_half_p_neg1], + [threef_mod_p, y_of_threef], + [threef_mod_p, neg_y_of_threef], + [ + x_of_p_plus1_half, + p_plus1_half, + ], # this is annoying because sqrt(.) = (p+1)/2 which is exactly at the cut off of neg vs pos + [x_of_p_plus1_half, neg_p_plus1_half], # invalid - [ p_plus1, neg_two ], # invalid x>=p - [ p_plus2, sqrt_11 ], # invalid x>=p - [ three_f, y_of_threef ], # invalid x>=p - [ three_f, neg_y_of_threef ], # invalid x>=p - [ one, p_plus2 ], # invalid y>=p - [ cbrt_neg2, p_plus1 ], # invalid y>=p - [ p, one ], # invalid x>=p + not on curve - [ one, p ], # invalid y>=p + not on curve - [ zero, one ], # not on curve - [ one, zero ], # not on curve - [ two, one ], # not on curve + [p_plus1, neg_two], # invalid x>=p + [p_plus2, sqrt_11], # invalid x>=p + [three_f, y_of_threef], # invalid x>=p + [three_f, neg_y_of_threef], # invalid x>=p + [one, p_plus2], # invalid y>=p + [cbrt_neg2, p_plus1], # invalid y>=p + [p, one], # invalid x>=p + not on curve + [one, p], # invalid y>=p + not on curve + [zero, one], # not on curve + [one, zero], # not on curve + [two, one], # not on curve ] annoying_points = [ [base64.b16decode(coord, True) for coord in point] for point in annoying_points @@ -169,24 +174,12 @@ for point in annoying_points: x = point[0] y = point[1] - very_annoying_points.append([ - bytes([x[0] | 0x80]) + x[1:], y - ]) - very_annoying_points.append([ - bytes([x[0] | 0x40]) + x[1:], y - ]) - very_annoying_points.append([ - bytes([x[0] | 0xC0]) + x[1:], y - ]) - very_annoying_points.append([ - x, bytes([y[0] | 0x80]) + y[1:] - ]) - very_annoying_points.append([ - x, bytes([y[0] | 0x40]) + y[1:] - ]) - very_annoying_points.append([ - x, bytes([y[0] | 0xC0]) + y[1:] - ]) + very_annoying_points.append([bytes([x[0] | 0x80]) + x[1:], y]) + very_annoying_points.append([bytes([x[0] | 0x40]) + x[1:], y]) + very_annoying_points.append([bytes([x[0] | 0xC0]) + x[1:], y]) + very_annoying_points.append([x, bytes([y[0] | 0x80]) + y[1:]]) + very_annoying_points.append([x, bytes([y[0] | 0x40]) + y[1:]]) + very_annoying_points.append([x, bytes([y[0] | 0xC0]) + y[1:]]) # def xprint2(name, val): # print(name+"\t= [\""+lift(val[0]).hex().rjust(64, "0")+"\",\n\t \""+lift(val[1]).hex().rjust(64, "0")+"\"]") @@ -218,120 +211,132 @@ # xprint2("q_x", Q[0]) # xprint2("q_y", Q[1]) # xprint2("-q_y", -Q[1]) -zero_fp2 = [ zero, zero ] -one_fp2 = [ one, zero ] -four_fp2 = [ four, zero ] -neg_one_fp2 = [ neg_one, zero ] -neg_four_fp2 = [ neg_four, zero ] -u_fp2 = [ zero, one ] -sqrt_b_plus1 = ["07fb3d558dafafb6bf6dd326a5fefe0beca3f9ac3bd999a390d504fad34b0b8c", - "2351dcdda257b62181cbd745dfee16d5fdf4eb185bbcf33c20a0fe6eaa9cb4a3"] -neg_sqrt_b_plus1 = ["2869111d5381f072f8e2728fdb825a51aadd70e52c9830e9ab4b871c0531f1bb", - "0d1271953ed9ea0836846e70a1934187998c7f790cb4d7511b7f8da82de048a4"] -sqrt_b_plus8 = ["181604d0560080401c08b557815482553e278257d98100d193a011c42782474d", - "04f21f9d99cc25f694cf22ff70dc0ac4692e7a721b725dc454a217f04bd03e33"] -neg_sqrt_b_plus8 = ["184e49a28b311fe99c47905f002cd6085959e8398ef0c9bba8807a52b0fab5fa", - "2b722ed547657a33238122b710a54d992e52f01f4cff6cc8e77e74268cacbf14"] -sqrt_b_plus_u3 = ["23712136978ed49faf2120ca4f7f71cfd4e7b46ffa0ea89edbc94ddc59238e9f", - "28a7a81c6bf2a75dc9f0125bb581747e9e6b33fc3b2710a2309cef97a3163c65"] -neg_sqrt_b_plus_u3 = ["0cf32d3c49a2cb8a092f24ec3201e68dc299b6216e6321ee60573e3a7f596ea8", - "07bca656753ef8cbee60335acbffe3def91636952d4ab9eb0b839c7f3566c0e2"] -x_of_4_neg_b = ["2546ace32139a7a3c69640d9df58e150b88a42c976cafdef331b58675f396376", - "2994b43083ae5696b5cceb1ac5215caea04df0465b26971adc5ce02d0eb9cf1e"] -p0_x = ["2596bb90715dfa4741dcbeaf28c320208deb53db69c03bdc77f94bfa8d9c5009", - "149c5d10b3868d761097695617918ab5e34e0738d6599f2b819039699b0b67bd"] -p0_y = ["090b286ef054afb53f78b704798292c0a34050335d9e5ffde8c44ccce1b7ce65", - "017bcb12e82231f89202cad867962b32340b4fb0feac5c4a9b54e71818a4e995"] -p0_neg_y = ["27592603f0dcf07478d78eb207fec59cf4411a5e0ad36a8f535c3f49f6c52ee2", - "2ee8835ff90f6e31264d7ade19eb2d2b63761ae069c56e42a0cba4febfd813b2"] -p1_x = ["2dfdbddb35cd04b9ce74a7a70a01cb33c68438b1f204f7eedb9cb04b80059a57", - "195a872169329de142bed50d425185fbca9cb6a98705001a4ac22a88844146c5"] -p1_y = ["24d32fefd984c28bfd9adf9fbc87b8e942127e8c65185f836bf305ac110f882f", - "041122306036b204a1fbf64c80d523315dda91df56a9542308f4cd4a2ab178ed"] -p1_neg_y = ["0b911e8307acdd9dbab56616c4f99f74556eec0503596b09d02d866ac76d7518", - "2c532c4280faee2516544f6a00ac352c39a6d8b211c8766a332bbeccadcb845a"] +zero_fp2 = [zero, zero] +one_fp2 = [one, zero] +four_fp2 = [four, zero] +neg_one_fp2 = [neg_one, zero] +neg_four_fp2 = [neg_four, zero] +u_fp2 = [zero, one] +sqrt_b_plus1 = [ + "07fb3d558dafafb6bf6dd326a5fefe0beca3f9ac3bd999a390d504fad34b0b8c", + "2351dcdda257b62181cbd745dfee16d5fdf4eb185bbcf33c20a0fe6eaa9cb4a3", +] +neg_sqrt_b_plus1 = [ + "2869111d5381f072f8e2728fdb825a51aadd70e52c9830e9ab4b871c0531f1bb", + "0d1271953ed9ea0836846e70a1934187998c7f790cb4d7511b7f8da82de048a4", +] +sqrt_b_plus8 = [ + "181604d0560080401c08b557815482553e278257d98100d193a011c42782474d", + "04f21f9d99cc25f694cf22ff70dc0ac4692e7a721b725dc454a217f04bd03e33", +] +neg_sqrt_b_plus8 = [ + "184e49a28b311fe99c47905f002cd6085959e8398ef0c9bba8807a52b0fab5fa", + "2b722ed547657a33238122b710a54d992e52f01f4cff6cc8e77e74268cacbf14", +] +sqrt_b_plus_u3 = [ + "23712136978ed49faf2120ca4f7f71cfd4e7b46ffa0ea89edbc94ddc59238e9f", + "28a7a81c6bf2a75dc9f0125bb581747e9e6b33fc3b2710a2309cef97a3163c65", +] +neg_sqrt_b_plus_u3 = [ + "0cf32d3c49a2cb8a092f24ec3201e68dc299b6216e6321ee60573e3a7f596ea8", + "07bca656753ef8cbee60335acbffe3def91636952d4ab9eb0b839c7f3566c0e2", +] +x_of_4_neg_b = [ + "2546ace32139a7a3c69640d9df58e150b88a42c976cafdef331b58675f396376", + "2994b43083ae5696b5cceb1ac5215caea04df0465b26971adc5ce02d0eb9cf1e", +] +p0_x = [ + "2596bb90715dfa4741dcbeaf28c320208deb53db69c03bdc77f94bfa8d9c5009", + "149c5d10b3868d761097695617918ab5e34e0738d6599f2b819039699b0b67bd", +] +p0_y = [ + "090b286ef054afb53f78b704798292c0a34050335d9e5ffde8c44ccce1b7ce65", + "017bcb12e82231f89202cad867962b32340b4fb0feac5c4a9b54e71818a4e995", +] +p0_neg_y = [ + "27592603f0dcf07478d78eb207fec59cf4411a5e0ad36a8f535c3f49f6c52ee2", + "2ee8835ff90f6e31264d7ade19eb2d2b63761ae069c56e42a0cba4febfd813b2", +] +p1_x = [ + "2dfdbddb35cd04b9ce74a7a70a01cb33c68438b1f204f7eedb9cb04b80059a57", + "195a872169329de142bed50d425185fbca9cb6a98705001a4ac22a88844146c5", +] +p1_y = [ + "24d32fefd984c28bfd9adf9fbc87b8e942127e8c65185f836bf305ac110f882f", + "041122306036b204a1fbf64c80d523315dda91df56a9542308f4cd4a2ab178ed", +] +p1_neg_y = [ + "0b911e8307acdd9dbab56616c4f99f74556eec0503596b09d02d866ac76d7518", + "2c532c4280faee2516544f6a00ac352c39a6d8b211c8766a332bbeccadcb845a", +] annoying_points_g2 = [ # there's no point with y=0 # valid - [ zero_fp2, zero_fp2 ], # point at infinity - [ p0_x, p0_y ], # y[0], y[1] have the same sign - [ p0_x, p0_neg_y ], - [ p1_x, p1_y ], # y[0], y[1] have opposite signs - [ p1_x, p1_neg_y ], + [zero_fp2, zero_fp2], # point at infinity + [p0_x, p0_y], # y[0], y[1] have the same sign + [p0_x, p0_neg_y], + [p1_x, p1_y], # y[0], y[1] have opposite signs + [p1_x, p1_neg_y], # invalid - [ [p, zero], [zero, zero] ], # point at infinity - invalid x[0]>=p - [ [zero, p], [zero, zero] ], # point at infinity - invalid x[1]>=p - [ [zero, zero], [p, zero] ], # point at infinity - invalid y[0]>=p - [ [zero, zero], [zero, p] ], # point at infinity - invalid y[1]>=p - [ [p_plus1, zero], sqrt_b_plus1 ], # invalid x[0]>=p - [ [one, p], sqrt_b_plus1 ], # invalid x[1]>=p - [ x_of_4_neg_b, [p_plus4, zero] ], # invalid y[0]>=p - [ x_of_4_neg_b, [four, p] ], # invalid y[1]>=p - [ zero_fp2, one_fp2 ], # not on curve (decompressed x to point at infinity) - [ one_fp2, zero_fp2 ], # not on curve (can decompress x) - [ four_fp2, zero_fp2 ], # not on curve (can't decompress x) - [ one_fp2, sqrt_b_plus1 ], # on curve, not in group - y[0], y[1] have opposite signs - [ one_fp2, neg_sqrt_b_plus1 ], - [ u_fp2, sqrt_b_plus_u3 ], # on curve, not in group - y[0], y[1] have the same sign - [ u_fp2, neg_sqrt_b_plus_u3 ], + [[p, zero], [zero, zero]], # point at infinity - invalid x[0]>=p + [[zero, p], [zero, zero]], # point at infinity - invalid x[1]>=p + [[zero, zero], [p, zero]], # point at infinity - invalid y[0]>=p + [[zero, zero], [zero, p]], # point at infinity - invalid y[1]>=p + [[p_plus1, zero], sqrt_b_plus1], # invalid x[0]>=p + [[one, p], sqrt_b_plus1], # invalid x[1]>=p + [x_of_4_neg_b, [p_plus4, zero]], # invalid y[0]>=p + [x_of_4_neg_b, [four, p]], # invalid y[1]>=p + [zero_fp2, one_fp2], # not on curve (decompressed x to point at infinity) + [one_fp2, zero_fp2], # not on curve (can decompress x) + [four_fp2, zero_fp2], # not on curve (can't decompress x) + [one_fp2, sqrt_b_plus1], # on curve, not in group - y[0], y[1] have opposite signs + [one_fp2, neg_sqrt_b_plus1], + [u_fp2, sqrt_b_plus_u3], # on curve, not in group - y[0], y[1] have the same sign + [u_fp2, neg_sqrt_b_plus_u3], ] annoying_points_g2 = [ # coord[1] coord[0] because big endian - [base64.b16decode(coord[1], True)+base64.b16decode(coord[0], True) for coord in point] for point in annoying_points_g2 + [ + base64.b16decode(coord[1], True) + base64.b16decode(coord[0], True) + for coord in point + ] + for point in annoying_points_g2 ] very_annoying_points_g2 = [point for point in annoying_points_g2] for point in annoying_points_g2: x = point[0] y = point[1] - very_annoying_points_g2.append([ - bytes([x[0] | 0x80]) + x[1:], y - ]) - very_annoying_points_g2.append([ - bytes([x[0] | 0x40]) + x[1:], y - ]) - very_annoying_points_g2.append([ - bytes([x[0] | 0xC0]) + x[1:], y - ]) - very_annoying_points_g2.append([ - x[:32] + bytes([x[32] | 0x80]) + x[33:], y - ]) - very_annoying_points_g2.append([ - x[:32] + bytes([x[32] | 0x40]) + x[33:], y - ]) - very_annoying_points_g2.append([ - x[:32] + bytes([x[32] | 0xC0]) + x[33:], y - ]) - very_annoying_points_g2.append([ - x, bytes([y[0] | 0x80]) + y[1:] - ]) - very_annoying_points_g2.append([ - x, bytes([y[0] | 0x40]) + y[1:] - ]) - very_annoying_points_g2.append([ - x, bytes([y[0] | 0xC0]) + y[1:] - ]) - very_annoying_points_g2.append([ - x, y[:32] + bytes([y[32] | 0x80]) + y[33:] - ]) - very_annoying_points_g2.append([ - x, y[:32] + bytes([y[32] | 0x40]) + y[33:] - ]) - very_annoying_points_g2.append([ - x, y[:32] + bytes([y[32] | 0xC0]) + y[33:] - ]) + very_annoying_points_g2.append([bytes([x[0] | 0x80]) + x[1:], y]) + very_annoying_points_g2.append([bytes([x[0] | 0x40]) + x[1:], y]) + very_annoying_points_g2.append([bytes([x[0] | 0xC0]) + x[1:], y]) + very_annoying_points_g2.append([x[:32] + bytes([x[32] | 0x80]) + x[33:], y]) + very_annoying_points_g2.append([x[:32] + bytes([x[32] | 0x40]) + x[33:], y]) + very_annoying_points_g2.append([x[:32] + bytes([x[32] | 0xC0]) + x[33:], y]) + very_annoying_points_g2.append([x, bytes([y[0] | 0x80]) + y[1:]]) + very_annoying_points_g2.append([x, bytes([y[0] | 0x40]) + y[1:]]) + very_annoying_points_g2.append([x, bytes([y[0] | 0xC0]) + y[1:]]) + very_annoying_points_g2.append([x, y[:32] + bytes([y[32] | 0x80]) + y[33:]]) + very_annoying_points_g2.append([x, y[:32] + bytes([y[32] | 0x40]) + y[33:]]) + very_annoying_points_g2.append([x, y[:32] + bytes([y[32] | 0xC0]) + y[33:]]) + def exact_cu_cost(data_vec): return CU_BASE + CU_PER_ELEM * len(data_vec) * len(data_vec) + def _into_key_data(key_prefix, test_vectors): return [(key_prefix + str(j), data) for j, data in enumerate(test_vectors)] + test_vectors_add = [ # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1547 # invalid op { - "heap_prefix": base64.b16decode("18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", True), + "heap_prefix": base64.b16decode( + "18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", + True, + ), "op": 1, # sub not implemented "input_addr": HEAP_START, "input_size": ADD_SZ, @@ -339,29 +344,36 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": ADD_CU, }, { - "heap_prefix": base64.b16decode("18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", True), + "heap_prefix": base64.b16decode( + "18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", + True, + ), "op": 4, "input_addr": HEAP_START, "input_size": ADD_SZ, "result_addr": HEAP_START, "cu_avail": ADD_CU, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1551 # cost { - "heap_prefix": base64.b16decode("18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", True), + "heap_prefix": base64.b16decode( + "18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", + True, + ), "op": ADD_OP, "input_addr": HEAP_START, "input_size": ADD_SZ, "result_addr": HEAP_START, "cu_avail": ADD_CU - 1, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1553-L1565 # i/o { - "heap_prefix": base64.b16decode("18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", True), + "heap_prefix": base64.b16decode( + "18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", + True, + ), "op": ADD_OP, "input_addr": HEAP_START + 1, "input_size": ADD_SZ, @@ -369,18 +381,23 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": ADD_CU, }, { - "heap_prefix": base64.b16decode("18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", True), + "heap_prefix": base64.b16decode( + "18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", + True, + ), "op": ADD_OP, "input_addr": HEAP_START, "input_size": ADD_SZ, "result_addr": HEAP_START + 100, "cu_avail": ADD_CU, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1580-L1589 # actual op - all these tests either return Ok(0) or Ok(1) { - "heap_prefix": base64.b16decode("18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", True), + "heap_prefix": base64.b16decode( + "18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", + True, + ), "op": ADD_OP, "input_addr": HEAP_START, "input_size": ADD_SZ, @@ -389,7 +406,10 @@ def _into_key_data(key_prefix, test_vectors): }, # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/program/src/alt_bn128/mod.rs#L164 { - "heap_prefix": base64.b16decode("18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d700", True), + "heap_prefix": base64.b16decode( + "18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d700", + True, + ), "op": ADD_OP, "input_addr": HEAP_START, "input_size": ADD_SZ + 1, @@ -400,7 +420,10 @@ def _into_key_data(key_prefix, test_vectors): # this can never happen # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/program/src/alt_bn128/mod.rs#L175 { - "heap_prefix": base64.b16decode("ffb18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", True), + "heap_prefix": base64.b16decode( + "ffb18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17d7", + True, + ), "op": ADD_OP, "input_addr": HEAP_START, "input_size": ADD_SZ, @@ -411,7 +434,10 @@ def _into_key_data(key_prefix, test_vectors): # this can never happen # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/program/src/alt_bn128/mod.rs#L181 { - "heap_prefix": base64.b16decode("18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17ff", True), + "heap_prefix": base64.b16decode( + "18b18acfb4c2c30276db5411368e7185b311dd124691610c5d3b74034e093dc9063c909c4720840cb5134cb9f59fa749755796819658d32efc0d288198f3726607c2b7f58a84bd6145f00c9c2bc0bb1a187f20ff2c92963a88019e7c6a014eed06614e20c147e940f2d70da3f74c9a17df361706a4485c742bd6788478fa17ff", + True, + ), "op": ADD_OP, "input_addr": HEAP_START, "input_size": ADD_SZ, @@ -422,7 +448,6 @@ def _into_key_data(key_prefix, test_vectors): # this can never happen # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/program/src/alt_bn128/mod.rs#L195 # this can never happen - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1594 # this can never happen ] @@ -442,32 +467,39 @@ def _into_key_data(key_prefix, test_vectors): ] for test in add_inputs: input = base64.b16decode(test, True) - test_vectors_add.append({ - "heap_prefix": bytes([0] * 64) + input, - "op": ADD_OP, - "input_addr": HEAP_START + 64, - "input_size": len(input), - "result_addr": HEAP_START, - "cu_avail": ADD_CU, - }) + test_vectors_add.append( + { + "heap_prefix": bytes([0] * 64) + input, + "op": ADD_OP, + "input_addr": HEAP_START + 64, + "input_size": len(input), + "result_addr": HEAP_START, + "cu_avail": ADD_CU, + } + ) test_vectors_mul = [ # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1551 # cost { - "heap_prefix": base64.b16decode("2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c2", True), + "heap_prefix": base64.b16decode( + "2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c2", + True, + ), "op": MUL_OP, "input_addr": HEAP_START, "input_size": MUL_SZ, "result_addr": HEAP_START, "cu_avail": MUL_CU - 1, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1553-L1565 # i/o { - "heap_prefix": base64.b16decode("2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c2", True), + "heap_prefix": base64.b16decode( + "2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c2", + True, + ), "op": MUL_OP, "input_addr": HEAP_START + 1, "input_size": MUL_SZ, @@ -475,18 +507,23 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": MUL_CU, }, { - "heap_prefix": base64.b16decode("2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c2", True), + "heap_prefix": base64.b16decode( + "2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c2", + True, + ), "op": MUL_OP, "input_addr": HEAP_START, "input_size": MUL_SZ, "result_addr": HEAP_START + 100, "cu_avail": MUL_CU, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1580-L1589 # actual op - all these tests either return Ok(0) or Ok(1) { - "heap_prefix": base64.b16decode("2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c2", True), + "heap_prefix": base64.b16decode( + "2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c2", + True, + ), "op": MUL_OP, "input_addr": HEAP_START, "input_size": MUL_SZ, @@ -495,7 +532,10 @@ def _into_key_data(key_prefix, test_vectors): }, # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/program/src/alt_bn128/mod.rs#L202 { - "heap_prefix": base64.b16decode("2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c200", True), + "heap_prefix": base64.b16decode( + "2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c200", + True, + ), "op": MUL_OP, "input_addr": HEAP_START, "input_size": MUL_SZ + 1, # implementation bug @@ -503,7 +543,11 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": MUL_CU, }, { - "heap_prefix": base64.b16decode("2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c200", True) + bytes([0]*32), + "heap_prefix": base64.b16decode( + "2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c200", + True, + ) + + bytes([0] * 32), "op": MUL_OP, "input_addr": HEAP_START, "input_size": MUL_SZ + 33, @@ -514,7 +558,10 @@ def _into_key_data(key_prefix, test_vectors): # this can never happen # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/program/src/alt_bn128/mod.rs#L213 { - "heap_prefix": base64.b16decode("ffd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c2", True), + "heap_prefix": base64.b16decode( + "ffd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb20400000000000000000000000000000000000000000000000011138ce750fa15c2", + True, + ), "op": MUL_OP, "input_addr": HEAP_START, "input_size": MUL_SZ, @@ -523,7 +570,10 @@ def _into_key_data(key_prefix, test_vectors): }, # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/program/src/alt_bn128/mod.rs#L217 { - "heap_prefix": base64.b16decode("2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb204ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", True), + "heap_prefix": base64.b16decode( + "2bd3e6d0f3b142924f5ca7b49ce5b9d54c4703d7ae5648e61d02268b1a0a9fb721611ce0a6af85915e2f1d70300909ce2e49dfad4a4619c8390cae66cefdb204ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + True, + ), "op": MUL_OP, "input_addr": HEAP_START, "input_size": MUL_SZ, @@ -556,42 +606,51 @@ def _into_key_data(key_prefix, test_vectors): ] for test in mul_inputs: input = base64.b16decode(test, True) - test_vectors_mul.append({ - "heap_prefix": bytes([0] * 64) + input, - "op": MUL_OP, - "input_addr": HEAP_START + 64, - "input_size": len(input), - "result_addr": HEAP_START, - "cu_avail": MUL_CU, - }) -for point in very_annoying_points: - for scalar in annoying_scalars: - input = point[0] + point[1] + scalar - test_vectors_mul.append({ + test_vectors_mul.append( + { "heap_prefix": bytes([0] * 64) + input, "op": MUL_OP, "input_addr": HEAP_START + 64, "input_size": len(input), "result_addr": HEAP_START, "cu_avail": MUL_CU, - }) + } + ) +for point in very_annoying_points: + for scalar in annoying_scalars: + input = point[0] + point[1] + scalar + test_vectors_mul.append( + { + "heap_prefix": bytes([0] * 64) + input, + "op": MUL_OP, + "input_addr": HEAP_START + 64, + "input_size": len(input), + "result_addr": HEAP_START, + "cu_avail": MUL_CU, + } + ) test_vectors_pairing = [ # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1551 # cost { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", + True, + ), "op": PAIRING_OP, "input_addr": HEAP_START, "input_size": PAIRING_SZ, "result_addr": HEAP_START, "cu_avail": PAIRING_CU - 1, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1553-L1565 # i/o { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", + True, + ), "op": PAIRING_OP, "input_addr": HEAP_START + 1, "input_size": PAIRING_SZ, @@ -599,18 +658,23 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": PAIRING_CU, }, { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", + True, + ), "op": PAIRING_OP, "input_addr": HEAP_START, "input_size": PAIRING_SZ, "result_addr": HEAP_START + 360, "cu_avail": PAIRING_CU, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1580-L1589 # actual op - all these tests either return Ok(0) or Ok(1) { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", + True, + ), "op": PAIRING_OP, "input_addr": HEAP_START, "input_size": PAIRING_SZ, @@ -627,7 +691,10 @@ def _into_key_data(key_prefix, test_vectors): }, # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/program/src/alt_bn128/mod.rs#L244 { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", + True, + ), "op": PAIRING_OP, "input_addr": HEAP_START, "input_size": PAIRING_SZ - 1, # implementation bug @@ -635,7 +702,10 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": PAIRING_CU, }, { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", + True, + ), "op": PAIRING_OP, "input_addr": HEAP_START, "input_size": 191, # implementation bug @@ -644,7 +714,10 @@ def _into_key_data(key_prefix, test_vectors): }, # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/program/src/alt_bn128/mod.rs#L261 { - "heap_prefix": base64.b16decode("ff76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", True), + "heap_prefix": base64.b16decode( + "ff76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa", + True, + ), "op": PAIRING_OP, "input_addr": HEAP_START, "input_size": PAIRING_SZ, @@ -653,7 +726,10 @@ def _into_key_data(key_prefix, test_vectors): }, # https://github.com/anza-xyz/agave/blob/v1.18.12/sdk/program/src/alt_bn128/mod.rs#L273 { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7dff", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550111e129f1cf1097710d41c4ac70fcdfa5ba2023c6ff1cbeac322de49d1b6df7c2032c61a830e3c17286de9462bf242fca2883585b93870a73853face6a6bf411198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c21800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7dff", + True, + ), "op": PAIRING_OP, "input_addr": HEAP_START, "input_size": PAIRING_SZ, @@ -680,65 +756,78 @@ def _into_key_data(key_prefix, test_vectors): ] for test in pairing_inputs: input = base64.b16decode(test, True) - test_vectors_pairing.append({ - "heap_prefix": bytes([0] * 32) + input, - "op": PAIRING_OP, - "input_addr": HEAP_START + 32, - "input_size": len(input), - "result_addr": HEAP_START, - "cu_avail": PAIRING_CU + 12121 * 20, # enough CUs for all tests - }) + test_vectors_pairing.append( + { + "heap_prefix": bytes([0] * 32) + input, + "op": PAIRING_OP, + "input_addr": HEAP_START + 32, + "input_size": len(input), + "result_addr": HEAP_START, + "cu_avail": PAIRING_CU + 12121 * 20, # enough CUs for all tests + } + ) # pairing checks G2 subgroup membership, so we should run through the G2 (very) annoying points for g2 in very_annoying_points_g2: input = annoying_points[1][0] + annoying_points[1][1] + g2[0] + g2[1] - test_vectors_pairing.append({ - "heap_prefix": bytes([0] * 32) + input, - "op": PAIRING_OP, - "input_addr": HEAP_START + 32, - "input_size": len(input), - "result_addr": HEAP_START, - "cu_avail": PAIRING_CU + 12121 * 20, # enough CUs for all tests - }) + test_vectors_pairing.append( + { + "heap_prefix": bytes([0] * 32) + input, + "op": PAIRING_OP, + "input_addr": HEAP_START + 32, + "input_size": len(input), + "result_addr": HEAP_START, + "cu_avail": PAIRING_CU + 12121 * 20, # enough CUs for all tests + } + ) # pairing checks G2 subgroup membership, so we should run through the G2 (very) annoying points for g1 in very_annoying_points: input = g1[0] + g1[1] + annoying_points_g2[1][0] + annoying_points_g2[1][1] - test_vectors_pairing.append({ - "heap_prefix": bytes([0] * 32) + input, - "op": PAIRING_OP, - "input_addr": HEAP_START + 32, - "input_size": len(input), - "result_addr": HEAP_START, - "cu_avail": PAIRING_CU + 12121 * 20, # enough CUs for all tests - }) + test_vectors_pairing.append( + { + "heap_prefix": bytes([0] * 32) + input, + "op": PAIRING_OP, + "input_addr": HEAP_START + 32, + "input_size": len(input), + "result_addr": HEAP_START, + "cu_avail": PAIRING_CU + 12121 * 20, # enough CUs for all tests + } + ) test_vectors_compress_g1 = [ # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1890 # invalid op { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", + True, + ), "op": 4, "input_addr": HEAP_START, "input_size": COMP_G1_SZ, "result_addr": HEAP_START, "cu_avail": COMP_G1_CU, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1813 # cost { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", + True, + ), "op": COMP_G1_OP, "input_addr": HEAP_START, "input_size": COMP_G1_SZ, "result_addr": HEAP_START, "cu_avail": COMP_G1_CU - 1, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1815-L1827 # i/o { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", + True, + ), "op": COMP_G1_OP, "input_addr": HEAP_START, "input_size": COMP_G1_SZ - 1, @@ -746,7 +835,10 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": COMP_G1_CU, }, { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", + True, + ), "op": COMP_G1_OP, "input_addr": HEAP_START + 1, "input_size": COMP_G1_SZ, @@ -754,18 +846,23 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": COMP_G1_CU, }, { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", + True, + ), "op": COMP_G1_OP, "input_addr": HEAP_START, "input_size": COMP_G1_SZ, "result_addr": HEAP_START + 33, "cu_avail": COMP_G1_CU, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1834-L1847 # actual op - all these tests either return Ok(0) or Ok(1) { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f593034dd2920f673e204fee2811c678745fc819b55d3e9d294e45c9b03a76aef41", + True, + ), "op": COMP_G1_OP, "input_addr": HEAP_START, "input_size": COMP_G1_SZ, @@ -773,14 +870,16 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": COMP_G1_CU, }, { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59002f7149c03b2c47b35163356519d1179affcf3b9487f7f857c3f11331120e06", True), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59002f7149c03b2c47b35163356519d1179affcf3b9487f7f857c3f11331120e06", + True, + ), "op": COMP_G1_OP, "input_addr": HEAP_START, "input_size": COMP_G1_SZ, "result_addr": HEAP_START, "cu_avail": COMP_G1_CU, }, - # firedancer # https://github.com/firedancer-io/firedancer/blob/a8c2e27b/src/ballet/bn254/fd_bn254.c#L17 # - https://github.com/firedancer-io/firedancer/blob/a8c2e27b/src/ballet/bn254/fd_bn254_g1.c#L263 @@ -793,31 +892,38 @@ def _into_key_data(key_prefix, test_vectors): ] for point in very_annoying_points: input = point[0] + point[1] - test_vectors_compress_g1.append({ - "heap_prefix": bytes([0] * 32) + input, - "op": COMP_G1_OP, - "input_addr": HEAP_START + 32, - "input_size": COMP_G1_SZ, - "result_addr": HEAP_START, - "cu_avail": COMP_G1_CU, - }) + test_vectors_compress_g1.append( + { + "heap_prefix": bytes([0] * 32) + input, + "op": COMP_G1_OP, + "input_addr": HEAP_START + 32, + "input_size": COMP_G1_SZ, + "result_addr": HEAP_START, + "cu_avail": COMP_G1_CU, + } + ) test_vectors_decompress_g1 = [ # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1813 # cost { - "heap_prefix": base64.b16decode("9c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True) + bytes([0]*32), + "heap_prefix": base64.b16decode( + "9c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True + ) + + bytes([0] * 32), "op": DECOMP_G1_OP, "input_addr": HEAP_START, "input_size": DECOMP_G1_SZ, "result_addr": HEAP_START, "cu_avail": DECOMP_G1_CU - 1, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1815-L1827 # i/o { - "heap_prefix": base64.b16decode("9c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True) + bytes([0]*32), + "heap_prefix": base64.b16decode( + "9c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True + ) + + bytes([0] * 32), "op": DECOMP_G1_OP, "input_addr": HEAP_START, "input_size": DECOMP_G1_SZ - 1, @@ -825,7 +931,10 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": DECOMP_G1_CU, }, { - "heap_prefix": base64.b16decode("9c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True) + bytes([0]*32), + "heap_prefix": base64.b16decode( + "9c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True + ) + + bytes([0] * 32), "op": DECOMP_G1_OP, "input_addr": HEAP_START + 33, "input_size": DECOMP_G1_SZ, @@ -833,18 +942,23 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": DECOMP_G1_CU, }, { - "heap_prefix": base64.b16decode("9c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True) + bytes([0]*32), + "heap_prefix": base64.b16decode( + "9c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True + ) + + bytes([0] * 32), "op": DECOMP_G1_OP, "input_addr": HEAP_START, "input_size": DECOMP_G1_SZ, "result_addr": HEAP_START + 1, "cu_avail": DECOMP_G1_CU, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1834-L1847 # actual op - all these tests either return Ok(0) or Ok(1) { - "heap_prefix": base64.b16decode("9c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True) + bytes([0]*32), + "heap_prefix": base64.b16decode( + "9c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True + ) + + bytes([0] * 32), "op": DECOMP_G1_OP, "input_addr": HEAP_START, "input_size": DECOMP_G1_SZ, @@ -852,14 +966,16 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": DECOMP_G1_CU, }, { - "heap_prefix": base64.b16decode("1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True) + bytes([0]*32), + "heap_prefix": base64.b16decode( + "1c76476f4def4bb94541d57ebba1193381ffa7aa76ada664dd31c16024c43f59", True + ) + + bytes([0] * 32), "op": DECOMP_G1_OP, "input_addr": HEAP_START, "input_size": DECOMP_G1_SZ, "result_addr": HEAP_START, "cu_avail": DECOMP_G1_CU, }, - # firedancer # https://github.com/firedancer-io/firedancer/blob/a8c2e27b/src/ballet/bn254/fd_bn254.c#L43 # - https://github.com/firedancer-io/firedancer/blob/a8c2e27b/src/ballet/bn254/fd_bn254_field.c#78 @@ -872,31 +988,38 @@ def _into_key_data(key_prefix, test_vectors): ] for point in very_annoying_points: input = point[0] - test_vectors_decompress_g1.append({ - "heap_prefix": bytes([0] * 64) + input, - "op": DECOMP_G1_OP, - "input_addr": HEAP_START + 64, - "input_size": len(input), - "result_addr": HEAP_START, - "cu_avail": DECOMP_G1_CU, - }) + test_vectors_decompress_g1.append( + { + "heap_prefix": bytes([0] * 64) + input, + "op": DECOMP_G1_OP, + "input_addr": HEAP_START + 64, + "input_size": len(input), + "result_addr": HEAP_START, + "cu_avail": DECOMP_G1_CU, + } + ) test_vectors_compress_g2 = [ # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1813 # cost { - "heap_prefix": base64.b16decode("209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550", True), + "heap_prefix": base64.b16decode( + "209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550", + True, + ), "op": COMP_G2_OP, "input_addr": HEAP_START, "input_size": COMP_G2_SZ, "result_addr": HEAP_START, "cu_avail": COMP_G2_CU - 1, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1815-L1827 # i/o { - "heap_prefix": base64.b16decode("209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550", True), + "heap_prefix": base64.b16decode( + "209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550", + True, + ), "op": COMP_G2_OP, "input_addr": HEAP_START, "input_size": COMP_G2_SZ - 1, @@ -904,7 +1027,10 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": COMP_G2_CU, }, { - "heap_prefix": base64.b16decode("209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550", True), + "heap_prefix": base64.b16decode( + "209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550", + True, + ), "op": COMP_G2_OP, "input_addr": HEAP_START + 1, "input_size": COMP_G2_SZ, @@ -912,18 +1038,23 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": COMP_G2_CU, }, { - "heap_prefix": base64.b16decode("209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550", True), + "heap_prefix": base64.b16decode( + "209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550", + True, + ), "op": COMP_G2_OP, "input_addr": HEAP_START, "input_size": COMP_G2_SZ, "result_addr": HEAP_START + 65, "cu_avail": COMP_G2_CU, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1834-L1847 # actual op - all these tests either return Ok(0) or Ok(1) { - "heap_prefix": base64.b16decode("209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550", True), + "heap_prefix": base64.b16decode( + "209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a416782bb8324af6cfc93537a2ad1a445cfd0ca2a71acd7ac41fadbf933c2a51be344d120a2a4cf30c1bf9845f20c6fe39e07ea2cce61f0c9bb048165fe5e4de877550", + True, + ), "op": COMP_G2_OP, "input_addr": HEAP_START, "input_size": COMP_G2_SZ, @@ -931,7 +1062,10 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": COMP_G2_CU, }, { - "heap_prefix": base64.b16decode("209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a4167804ac1c27ea61d6f480ad989c3d245b50f4da4fc3edadaadf7c8d4fec86bec8fa1e5a2425ee25843033f124ef834777def4b484725bd61a4525c0a631f9f587f7", True), + "heap_prefix": base64.b16decode( + "209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a4167804ac1c27ea61d6f480ad989c3d245b50f4da4fc3edadaadf7c8d4fec86bec8fa1e5a2425ee25843033f124ef834777def4b484725bd61a4525c0a631f9f587f7", + True, + ), "op": COMP_G2_OP, "input_addr": HEAP_START, "input_size": COMP_G2_SZ, @@ -941,31 +1075,40 @@ def _into_key_data(key_prefix, test_vectors): ] for point in very_annoying_points_g2: input = point[0] + point[1] - test_vectors_compress_g2.append({ - "heap_prefix": bytes([0] * 64) + input, - "op": COMP_G2_OP, - "input_addr": HEAP_START + 64, - "input_size": len(input), - "result_addr": HEAP_START, - "cu_avail": COMP_G2_CU, - }) + test_vectors_compress_g2.append( + { + "heap_prefix": bytes([0] * 64) + input, + "op": COMP_G2_OP, + "input_addr": HEAP_START + 64, + "input_size": len(input), + "result_addr": HEAP_START, + "cu_avail": COMP_G2_CU, + } + ) test_vectors_decompress_g2 = [ # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1813 # cost { - "heap_prefix": base64.b16decode("a09dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", True) + bytes([0]*64), + "heap_prefix": base64.b16decode( + "a09dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", + True, + ) + + bytes([0] * 64), "op": DECOMP_G2_OP, "input_addr": HEAP_START, "input_size": DECOMP_G2_SZ, "result_addr": HEAP_START, "cu_avail": DECOMP_G2_CU - 1, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1815-L1827 # i/o { - "heap_prefix": base64.b16decode("a09dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", True) + bytes([0]*64), + "heap_prefix": base64.b16decode( + "a09dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", + True, + ) + + bytes([0] * 64), "op": DECOMP_G2_OP, "input_addr": HEAP_START, "input_size": DECOMP_G2_SZ - 1, @@ -973,7 +1116,11 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": DECOMP_G2_CU, }, { - "heap_prefix": base64.b16decode("a09dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", True) + bytes([0]*64), + "heap_prefix": base64.b16decode( + "a09dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", + True, + ) + + bytes([0] * 64), "op": DECOMP_G2_OP, "input_addr": HEAP_START + 65, "input_size": DECOMP_G2_SZ, @@ -981,18 +1128,25 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": DECOMP_G2_CU, }, { - "heap_prefix": base64.b16decode("a09dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", True) + bytes([0]*64), + "heap_prefix": base64.b16decode( + "a09dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", + True, + ) + + bytes([0] * 64), "op": DECOMP_G2_OP, "input_addr": HEAP_START, "input_size": DECOMP_G2_SZ, "result_addr": HEAP_START + 1, "cu_avail": DECOMP_G2_CU, }, - # https://github.com/anza-xyz/agave/blob/v1.18.12/programs/bpf_loader/src/syscalls/mod.rs#L1834-L1847 # actual op - all these tests either return Ok(0) or Ok(1) { - "heap_prefix": base64.b16decode("a09dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", True) + bytes([0]*64), + "heap_prefix": base64.b16decode( + "a09dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", + True, + ) + + bytes([0] * 64), "op": DECOMP_G2_OP, "input_addr": HEAP_START, "input_size": DECOMP_G2_SZ, @@ -1000,7 +1154,11 @@ def _into_key_data(key_prefix, test_vectors): "cu_avail": DECOMP_G2_CU, }, { - "heap_prefix": base64.b16decode("209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", True) + bytes([0]*64), + "heap_prefix": base64.b16decode( + "209dd15ebff5d46c4bd888e51a93cf99a7329636c63514396b4a452003a35bf704bf11ca01483bfa8b34b43561848d28905960114c8ac04049af4b6315a41678", + True, + ) + + bytes([0] * 64), "op": DECOMP_G2_OP, "input_addr": HEAP_START, "input_size": DECOMP_G2_SZ, @@ -1010,38 +1168,42 @@ def _into_key_data(key_prefix, test_vectors): ] for point in very_annoying_points_g2: input = point[0] - test_vectors_decompress_g2.append({ - "heap_prefix": bytes([0] * 128) + input, - "op": DECOMP_G2_OP, - "input_addr": HEAP_START + 128, - "input_size": len(input), - "result_addr": HEAP_START, - "cu_avail": DECOMP_G2_CU, - }) + test_vectors_decompress_g2.append( + { + "heap_prefix": bytes([0] * 128) + input, + "op": DECOMP_G2_OP, + "input_addr": HEAP_START + 128, + "input_size": len(input), + "result_addr": HEAP_START, + "cu_avail": DECOMP_G2_CU, + } + ) -test_vectors_group = \ - _into_key_data("a", test_vectors_add) + \ - _into_key_data("m", test_vectors_mul) + \ - _into_key_data("p", test_vectors_pairing) +test_vectors_group = ( + _into_key_data("a", test_vectors_add) + + _into_key_data("m", test_vectors_mul) + + _into_key_data("p", test_vectors_pairing) +) -test_vectors_compression = \ - _into_key_data("c1", test_vectors_compress_g1) + \ - _into_key_data("d1", test_vectors_decompress_g1) + \ - _into_key_data("c2", test_vectors_compress_g2) + \ - _into_key_data("d2", test_vectors_decompress_g2) +test_vectors_compression = ( + _into_key_data("c1", test_vectors_compress_g1) + + _into_key_data("d1", test_vectors_decompress_g1) + + _into_key_data("c2", test_vectors_compress_g2) + + _into_key_data("d2", test_vectors_decompress_g2) +) features = [ - 0xaaef1edeb6c5bf85, # enable_alt_bn128_syscall - 0x9bb55b5df1c396c5, # enable_alt_bn128_compression_syscall - 0x8ba9e9038d9fdcff, # simplify_alt_bn128_syscall_error_codes + 0xAAEF1EDEB6C5BF85, # enable_alt_bn128_syscall + 0x9BB55B5DF1C396C5, # enable_alt_bn128_compression_syscall + 0x8BA9E9038D9FDCFF, # simplify_alt_bn128_syscall_error_codes ] if __name__ == "__main__": print("Generating syscall alt_bn128 tests...") - for (key, test) in test_vectors_group: + for key, test in test_vectors_group: heap_prefix = test.get("heap_prefix", []) - syscall_ctx = pb.SyscallContext() + syscall_ctx = vm_pb.SyscallContext() syscall_ctx.syscall_invocation.function_name = b"sol_alt_bn128_group_op" syscall_ctx.syscall_invocation.heap_prefix = bytes(heap_prefix) syscall_ctx.vm_ctx.heap_max = len(heap_prefix) @@ -1050,8 +1212,10 @@ def _into_key_data(key_prefix, test_vectors): syscall_ctx.vm_ctx.r3 = test.get("input_size", 0) syscall_ctx.vm_ctx.r4 = test.get("result_addr", 0) syscall_ctx.instr_ctx.cu_avail = test.get("cu_avail", 0) - syscall_ctx.instr_ctx.program_id = bytes([0]*32) # solfuzz-agave expectes a program_id - syscall_ctx.vm_ctx.rodata = b"x" # fd expects some bytes + syscall_ctx.instr_ctx.program_id = bytes( + [0] * 32 + ) # solfuzz-agave expectes a program_id + syscall_ctx.vm_ctx.rodata = b"x" # fd expects some bytes syscall_ctx.instr_ctx.epoch_context.features.features.extend(features) @@ -1063,9 +1227,9 @@ def _into_key_data(key_prefix, test_vectors): print("done!") print("Generating syscall alt_bn128_compression tests...") - for (key, test) in test_vectors_compression: + for key, test in test_vectors_compression: heap_prefix = test.get("heap_prefix", []) - syscall_ctx = pb.SyscallContext() + syscall_ctx = vm_pb.SyscallContext() syscall_ctx.syscall_invocation.function_name = b"sol_alt_bn128_compression" syscall_ctx.syscall_invocation.heap_prefix = bytes(heap_prefix) syscall_ctx.vm_ctx.heap_max = len(heap_prefix) @@ -1074,8 +1238,10 @@ def _into_key_data(key_prefix, test_vectors): syscall_ctx.vm_ctx.r3 = test.get("input_size", 0) syscall_ctx.vm_ctx.r4 = test.get("result_addr", 0) syscall_ctx.instr_ctx.cu_avail = test.get("cu_avail", 0) - syscall_ctx.instr_ctx.program_id = bytes([0]*32) # solfuzz-agave expectes a program_id - syscall_ctx.vm_ctx.rodata = b"x" # fd expects some bytes + syscall_ctx.instr_ctx.program_id = bytes( + [0] * 32 + ) # solfuzz-agave expectes a program_id + syscall_ctx.vm_ctx.rodata = b"x" # fd expects some bytes syscall_ctx.instr_ctx.epoch_context.features.features.extend(features) diff --git a/generators/syscalls_hash.py b/generators/syscalls_hash.py index b69db81..287262e 100644 --- a/generators/syscalls_hash.py +++ b/generators/syscalls_hash.py @@ -1,5 +1,5 @@ import hashlib -import test_suite.invoke_pb2 as pb +import test_suite.vm_pb2 as vm_pb import struct OUTPUT_DIR = "./test-vectors/syscall/tests/" @@ -8,12 +8,13 @@ CU_PER_BYTE = 1 # this is actually every 2 bytes... CU_MEM_OP = 10 + def heap_vec(data_vec, start): res = [] last = start + len(data_vec) * 16 for data in data_vec: - res += struct.pack('=3.0.9", - "tqdm~=4.66.0" + "tqdm~=4.66.0", + "protoletariat~=3.2.0", ] [project.scripts] diff --git a/src/test_suite/context_pb2.py b/src/test_suite/context_pb2.py new file mode 100644 index 0000000..b2bfbde --- /dev/null +++ b/src/test_suite/context_pb2.py @@ -0,0 +1,385 @@ +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 + +_sym_db = _symbol_database.Default() +DESCRIPTOR = _descriptor.FileDescriptor( + name="context.proto", + package="org.solana.sealevel.v1", + syntax="proto3", + serialized_pb=_b( + '\n\rcontext.proto\x12\x16org.solana.sealevel.v1"\x1e\n\nFeatureSet\x12\x10\n\x08features\x18\x01 \x03(\x06"8\n\x0bSeedAddress\x12\x0c\n\x04base\x18\x01 \x01(\x0c\x12\x0c\n\x04seed\x18\x02 \x01(\x0c\x12\r\n\x05owner\x18\x03 \x01(\x0c"«\x01\n\tAcctState\x12\x0f\n\x07address\x18\x01 \x01(\x0c\x12\x10\n\x08lamports\x18\x02 \x01(\x04\x12\x0c\n\x04data\x18\x03 \x01(\x0c\x12\x12\n\nexecutable\x18\x04 \x01(\x08\x12\x12\n\nrent_epoch\x18\x05 \x01(\x04\x12\r\n\x05owner\x18\x06 \x01(\x0c\x126\n\tseed_addr\x18\x07 \x01(\x0b2#.org.solana.sealevel.v1.SeedAddress"D\n\x0cEpochContext\x124\n\x08features\x18\x01 \x01(\x0b2".org.solana.sealevel.v1.FeatureSet"\x1b\n\x0bSlotContext\x12\x0c\n\x04slot\x18\x01 \x01(\x06b\x06proto3' + ), +) +_FEATURESET = _descriptor.Descriptor( + name="FeatureSet", + full_name="org.solana.sealevel.v1.FeatureSet", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="features", + full_name="org.solana.sealevel.v1.FeatureSet.features", + index=0, + number=1, + type=6, + cpp_type=4, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=41, + serialized_end=71, +) +_SEEDADDRESS = _descriptor.Descriptor( + name="SeedAddress", + full_name="org.solana.sealevel.v1.SeedAddress", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="base", + full_name="org.solana.sealevel.v1.SeedAddress.base", + index=0, + number=1, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="seed", + full_name="org.solana.sealevel.v1.SeedAddress.seed", + index=1, + number=2, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="owner", + full_name="org.solana.sealevel.v1.SeedAddress.owner", + index=2, + number=3, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=73, + serialized_end=129, +) +_ACCTSTATE = _descriptor.Descriptor( + name="AcctState", + full_name="org.solana.sealevel.v1.AcctState", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="address", + full_name="org.solana.sealevel.v1.AcctState.address", + index=0, + number=1, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="lamports", + full_name="org.solana.sealevel.v1.AcctState.lamports", + index=1, + number=2, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="data", + full_name="org.solana.sealevel.v1.AcctState.data", + index=2, + number=3, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="executable", + full_name="org.solana.sealevel.v1.AcctState.executable", + index=3, + number=4, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="rent_epoch", + full_name="org.solana.sealevel.v1.AcctState.rent_epoch", + index=4, + number=5, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="owner", + full_name="org.solana.sealevel.v1.AcctState.owner", + index=5, + number=6, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="seed_addr", + full_name="org.solana.sealevel.v1.AcctState.seed_addr", + index=6, + number=7, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=132, + serialized_end=303, +) +_EPOCHCONTEXT = _descriptor.Descriptor( + name="EpochContext", + full_name="org.solana.sealevel.v1.EpochContext", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="features", + full_name="org.solana.sealevel.v1.EpochContext.features", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=305, + serialized_end=373, +) +_SLOTCONTEXT = _descriptor.Descriptor( + name="SlotContext", + full_name="org.solana.sealevel.v1.SlotContext", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="slot", + full_name="org.solana.sealevel.v1.SlotContext.slot", + index=0, + number=1, + type=6, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=375, + serialized_end=402, +) +_ACCTSTATE.fields_by_name["seed_addr"].message_type = _SEEDADDRESS +_EPOCHCONTEXT.fields_by_name["features"].message_type = _FEATURESET +DESCRIPTOR.message_types_by_name["FeatureSet"] = _FEATURESET +DESCRIPTOR.message_types_by_name["SeedAddress"] = _SEEDADDRESS +DESCRIPTOR.message_types_by_name["AcctState"] = _ACCTSTATE +DESCRIPTOR.message_types_by_name["EpochContext"] = _EPOCHCONTEXT +DESCRIPTOR.message_types_by_name["SlotContext"] = _SLOTCONTEXT +_sym_db.RegisterFileDescriptor(DESCRIPTOR) +FeatureSet = _reflection.GeneratedProtocolMessageType( + "FeatureSet", + (_message.Message,), + dict(DESCRIPTOR=_FEATURESET, __module__="context_pb2"), +) +_sym_db.RegisterMessage(FeatureSet) +SeedAddress = _reflection.GeneratedProtocolMessageType( + "SeedAddress", + (_message.Message,), + dict(DESCRIPTOR=_SEEDADDRESS, __module__="context_pb2"), +) +_sym_db.RegisterMessage(SeedAddress) +AcctState = _reflection.GeneratedProtocolMessageType( + "AcctState", + (_message.Message,), + dict(DESCRIPTOR=_ACCTSTATE, __module__="context_pb2"), +) +_sym_db.RegisterMessage(AcctState) +EpochContext = _reflection.GeneratedProtocolMessageType( + "EpochContext", + (_message.Message,), + dict(DESCRIPTOR=_EPOCHCONTEXT, __module__="context_pb2"), +) +_sym_db.RegisterMessage(EpochContext) +SlotContext = _reflection.GeneratedProtocolMessageType( + "SlotContext", + (_message.Message,), + dict(DESCRIPTOR=_SLOTCONTEXT, __module__="context_pb2"), +) +_sym_db.RegisterMessage(SlotContext) diff --git a/src/test_suite/elf_pb2.py b/src/test_suite/elf_pb2.py new file mode 100644 index 0000000..60f03b4 --- /dev/null +++ b/src/test_suite/elf_pb2.py @@ -0,0 +1,362 @@ +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 + +_sym_db = _symbol_database.Default() +from . import context_pb2 as context__pb2 + +DESCRIPTOR = _descriptor.FileDescriptor( + name="elf.proto", + package="org.solana.sealevel.v1", + syntax="proto3", + serialized_pb=_b( + '\n\telf.proto\x12\x16org.solana.sealevel.v1\x1a\rcontext.proto"\x19\n\tELFBinary\x12\x0c\n\x04data\x18\x01 \x01(\x0c"\x9b\x01\n\x0cELFLoaderCtx\x12.\n\x03elf\x18\x01 \x01(\x0b2!.org.solana.sealevel.v1.ELFBinary\x124\n\x08features\x18\x02 \x01(\x0b2".org.solana.sealevel.v1.FeatureSet\x12\x0e\n\x06elf_sz\x18\x03 \x01(\x04\x12\x15\n\rdeploy_checks\x18\x04 \x01(\x08"~\n\x10ELFLoaderEffects\x12\x0e\n\x06rodata\x18\x01 \x01(\x0c\x12\x11\n\trodata_sz\x18\x02 \x01(\x04\x12\x10\n\x08text_cnt\x18\x04 \x01(\x04\x12\x10\n\x08text_off\x18\x05 \x01(\x04\x12\x10\n\x08entry_pc\x18\x06 \x01(\x04\x12\x11\n\tcalldests\x18\x07 \x03(\x04"\x81\x01\n\x10ELFLoaderFixture\x123\n\x05input\x18\x01 \x01(\x0b2$.org.solana.sealevel.v1.ELFLoaderCtx\x128\n\x06output\x18\x02 \x01(\x0b2(.org.solana.sealevel.v1.ELFLoaderEffectsb\x06proto3' + ), + dependencies=[context__pb2.DESCRIPTOR], +) +_ELFBINARY = _descriptor.Descriptor( + name="ELFBinary", + full_name="org.solana.sealevel.v1.ELFBinary", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="data", + full_name="org.solana.sealevel.v1.ELFBinary.data", + index=0, + number=1, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=52, + serialized_end=77, +) +_ELFLOADERCTX = _descriptor.Descriptor( + name="ELFLoaderCtx", + full_name="org.solana.sealevel.v1.ELFLoaderCtx", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="elf", + full_name="org.solana.sealevel.v1.ELFLoaderCtx.elf", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="features", + full_name="org.solana.sealevel.v1.ELFLoaderCtx.features", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="elf_sz", + full_name="org.solana.sealevel.v1.ELFLoaderCtx.elf_sz", + index=2, + number=3, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="deploy_checks", + full_name="org.solana.sealevel.v1.ELFLoaderCtx.deploy_checks", + index=3, + number=4, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=80, + serialized_end=235, +) +_ELFLOADEREFFECTS = _descriptor.Descriptor( + name="ELFLoaderEffects", + full_name="org.solana.sealevel.v1.ELFLoaderEffects", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="rodata", + full_name="org.solana.sealevel.v1.ELFLoaderEffects.rodata", + index=0, + number=1, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="rodata_sz", + full_name="org.solana.sealevel.v1.ELFLoaderEffects.rodata_sz", + index=1, + number=2, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="text_cnt", + full_name="org.solana.sealevel.v1.ELFLoaderEffects.text_cnt", + index=2, + number=4, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="text_off", + full_name="org.solana.sealevel.v1.ELFLoaderEffects.text_off", + index=3, + number=5, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="entry_pc", + full_name="org.solana.sealevel.v1.ELFLoaderEffects.entry_pc", + index=4, + number=6, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="calldests", + full_name="org.solana.sealevel.v1.ELFLoaderEffects.calldests", + index=5, + number=7, + type=4, + cpp_type=4, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=237, + serialized_end=363, +) +_ELFLOADERFIXTURE = _descriptor.Descriptor( + name="ELFLoaderFixture", + full_name="org.solana.sealevel.v1.ELFLoaderFixture", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="input", + full_name="org.solana.sealevel.v1.ELFLoaderFixture.input", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="output", + full_name="org.solana.sealevel.v1.ELFLoaderFixture.output", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=366, + serialized_end=495, +) +_ELFLOADERCTX.fields_by_name["elf"].message_type = _ELFBINARY +_ELFLOADERCTX.fields_by_name["features"].message_type = context__pb2._FEATURESET +_ELFLOADERFIXTURE.fields_by_name["input"].message_type = _ELFLOADERCTX +_ELFLOADERFIXTURE.fields_by_name["output"].message_type = _ELFLOADEREFFECTS +DESCRIPTOR.message_types_by_name["ELFBinary"] = _ELFBINARY +DESCRIPTOR.message_types_by_name["ELFLoaderCtx"] = _ELFLOADERCTX +DESCRIPTOR.message_types_by_name["ELFLoaderEffects"] = _ELFLOADEREFFECTS +DESCRIPTOR.message_types_by_name["ELFLoaderFixture"] = _ELFLOADERFIXTURE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) +ELFBinary = _reflection.GeneratedProtocolMessageType( + "ELFBinary", (_message.Message,), dict(DESCRIPTOR=_ELFBINARY, __module__="elf_pb2") +) +_sym_db.RegisterMessage(ELFBinary) +ELFLoaderCtx = _reflection.GeneratedProtocolMessageType( + "ELFLoaderCtx", + (_message.Message,), + dict(DESCRIPTOR=_ELFLOADERCTX, __module__="elf_pb2"), +) +_sym_db.RegisterMessage(ELFLoaderCtx) +ELFLoaderEffects = _reflection.GeneratedProtocolMessageType( + "ELFLoaderEffects", + (_message.Message,), + dict(DESCRIPTOR=_ELFLOADEREFFECTS, __module__="elf_pb2"), +) +_sym_db.RegisterMessage(ELFLoaderEffects) +ELFLoaderFixture = _reflection.GeneratedProtocolMessageType( + "ELFLoaderFixture", + (_message.Message,), + dict(DESCRIPTOR=_ELFLOADERFIXTURE, __module__="elf_pb2"), +) +_sym_db.RegisterMessage(ELFLoaderFixture) diff --git a/src/test_suite/fixture_utils.py b/src/test_suite/fixture_utils.py index 3b1c226..bde4742 100644 --- a/src/test_suite/fixture_utils.py +++ b/src/test_suite/fixture_utils.py @@ -7,7 +7,7 @@ prune_execution_result, ) import test_suite.globals as globals -import test_suite.invoke_pb2 as pb +import test_suite.invoke_pb2 as invoke_pb from google.protobuf import text_format from pathlib import Path @@ -81,7 +81,7 @@ def write_fixture_to_disk(file_stem: str, serialized_fixture: str) -> int: if globals.readable: # Deserialize fixture - fixture = pb.InstrFixture() + fixture = invoke_pb.InstrFixture() fixture.ParseFromString(serialized_fixture) # Encode fields for instruction context and effects @@ -129,12 +129,12 @@ def extract_context_from_fixture(fixture_file: Path): return 1 -def get_program_type(instr_fixture: pb.InstrFixture) -> str: +def get_program_type(instr_fixture: invoke_pb.InstrFixture) -> str: """ Get the program type based on the program / loader id. Args: - - fixture (pb.InstrFixture): Instruction fixture + - fixture (invoke_pb.InstrFixture): Instruction fixture Returns: - str | None: Program type (unknown if not found) diff --git a/src/test_suite/fuzz_context.py b/src/test_suite/fuzz_context.py index d820086..9ec7609 100644 --- a/src/test_suite/fuzz_context.py +++ b/src/test_suite/fuzz_context.py @@ -1,16 +1,19 @@ from test_suite.fuzz_interface import HarnessCtx -import test_suite.invoke_pb2 as pb +import test_suite.invoke_pb2 as invoke_pb +import test_suite.elf_pb2 as elf_pb +import test_suite.vm_pb2 as vm_pb import test_suite.instr.codec_utils as instr_codec import test_suite.syscall.codec_utils as syscall_codec ElfHarness = HarnessCtx( - fuzz_fn_name="sol_compat_elf_loader_v1", fixture_desc=pb.ELFLoaderFixture.DESCRIPTOR + fuzz_fn_name="sol_compat_elf_loader_v1", + fixture_desc=elf_pb.ELFLoaderFixture.DESCRIPTOR, ) InstrHarness = HarnessCtx( fuzz_fn_name="sol_compat_instr_execute_v1", - fixture_desc=pb.InstrFixture.DESCRIPTOR, + fixture_desc=invoke_pb.InstrFixture.DESCRIPTOR, context_human_encode_fn=instr_codec.encode_input, context_human_decode_fn=instr_codec.decode_input, effects_human_encode_fn=instr_codec.encode_output, @@ -19,6 +22,6 @@ SyscallHarness = HarnessCtx( fuzz_fn_name="sol_compat_vm_syscall_execute_v1", - fixture_desc=pb.SyscallFixture.DESCRIPTOR, + fixture_desc=vm_pb.SyscallFixture.DESCRIPTOR, effects_human_encode_fn=syscall_codec.encode_output, ) diff --git a/src/test_suite/instr/codec_utils.py b/src/test_suite/instr/codec_utils.py index 13be1c6..6e8a5e2 100644 --- a/src/test_suite/instr/codec_utils.py +++ b/src/test_suite/instr/codec_utils.py @@ -1,15 +1,15 @@ import base64 import fd58 -import test_suite.invoke_pb2 as pb +import test_suite.invoke_pb2 as invoke_pb -def decode_input(instruction_context: pb.InstrContext): +def decode_input(instruction_context: invoke_pb.InstrContext): """ Decode InstrContext fields in-place into human-readable format. Addresses are decoded from base58, data from base64. Args: - - instruction_context (pb.InstrContext): Instruction context (will be modified). + - instruction_context (invoke_pb.InstrContext): Instruction context (will be modified). """ if instruction_context.program_id: instruction_context.program_id = fd58.dec32(instruction_context.program_id) @@ -34,13 +34,13 @@ def decode_input(instruction_context: pb.InstrContext): instruction_context.data = base64.b64decode(instruction_context.data) -def encode_input(instruction_context: pb.InstrContext): +def encode_input(instruction_context: invoke_pb.InstrContext): """ Encode InstrContext fields in-place into binary, digestable format. Addresses are encoded in base58, data in base64. Args: - - instruction_context (pb.InstrContext): Instruction context (will be modified). + - instruction_context (invoke_pb.InstrContext): Instruction context (will be modified). """ if instruction_context.program_id: instruction_context.program_id = fd58.enc32(instruction_context.program_id) @@ -65,13 +65,13 @@ def encode_input(instruction_context: pb.InstrContext): instruction_context.data = base64.b64encode(instruction_context.data) -def encode_output(instruction_effects: pb.InstrEffects): +def encode_output(instruction_effects: invoke_pb.InstrEffects): """ Encode InstrEffects fields in-place into human-readable format. Addresses are encoded in base58, data in base64. Args: - - instruction_effects (pb.InstrEffects): Instruction effects (will be modified). + - instruction_effects (invoke_pb.InstrEffects): Instruction effects (will be modified). """ for i in range(len(instruction_effects.modified_accounts)): if instruction_effects.modified_accounts[i].address: diff --git a/src/test_suite/invoke_pb2.py b/src/test_suite/invoke_pb2.py index 1309b88..3b35452 100644 --- a/src/test_suite/invoke_pb2.py +++ b/src/test_suite/invoke_pb2.py @@ -1,1168 +1,459 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: invoke.proto - import sys -_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database from google.protobuf import descriptor_pb2 -# @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() - - - +from . import context_pb2 as context__pb2 +from . import txn_pb2 as txn__pb2 DESCRIPTOR = _descriptor.FileDescriptor( - name='invoke.proto', - package='org.solana.sealevel.v1', - syntax='proto3', - serialized_pb=_b('\n\x0cinvoke.proto\x12\x16org.solana.sealevel.v1\"\x1e\n\nFeatureSet\x12\x10\n\x08\x66\x65\x61tures\x18\x01 \x03(\x06\"s\n\tAcctState\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0c\x12\x10\n\x08lamports\x18\x02 \x01(\x04\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\x12\x12\n\nexecutable\x18\x04 \x01(\x08\x12\x12\n\nrent_epoch\x18\x05 \x01(\x04\x12\r\n\x05owner\x18\x06 \x01(\x0c\"D\n\x0c\x45pochContext\x12\x34\n\x08\x66\x65\x61tures\x18\x01 \x01(\x0b\x32\".org.solana.sealevel.v1.FeatureSet\"\r\n\x0bSlotContext\"\x0c\n\nTxnContext\"B\n\tInstrAcct\x12\r\n\x05index\x18\x01 \x01(\r\x12\x13\n\x0bis_writable\x18\x02 \x01(\x08\x12\x11\n\tis_signer\x18\x03 \x01(\x08\"\xf6\x02\n\x0cInstrContext\x12\x12\n\nprogram_id\x18\x01 \x01(\x0c\x12\x11\n\tloader_id\x18\x02 \x01(\x0c\x12\x33\n\x08\x61\x63\x63ounts\x18\x03 \x03(\x0b\x32!.org.solana.sealevel.v1.AcctState\x12\x39\n\x0einstr_accounts\x18\x04 \x03(\x0b\x32!.org.solana.sealevel.v1.InstrAcct\x12\x0c\n\x04\x64\x61ta\x18\x05 \x01(\x0c\x12\x10\n\x08\x63u_avail\x18\x06 \x01(\x04\x12\x37\n\x0btxn_context\x18\x07 \x01(\x0b\x32\".org.solana.sealevel.v1.TxnContext\x12\x39\n\x0cslot_context\x18\x08 \x01(\x0b\x32#.org.solana.sealevel.v1.SlotContext\x12;\n\repoch_context\x18\t \x01(\x0b\x32$.org.solana.sealevel.v1.EpochContext\"\x97\x01\n\x0cInstrEffects\x12\x0e\n\x06result\x18\x01 \x01(\x05\x12\x12\n\ncustom_err\x18\x02 \x01(\r\x12<\n\x11modified_accounts\x18\x03 \x03(\x0b\x32!.org.solana.sealevel.v1.AcctState\x12\x10\n\x08\x63u_avail\x18\x04 \x01(\x04\x12\x13\n\x0breturn_data\x18\x05 \x01(\x0c\"y\n\x0cInstrFixture\x12\x33\n\x05input\x18\x01 \x01(\x0b\x32$.org.solana.sealevel.v1.InstrContext\x12\x34\n\x06output\x18\x02 \x01(\x0b\x32$.org.solana.sealevel.v1.InstrEffects\"\x19\n\tELFBinary\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\"t\n\x0c\x45LFLoaderCtx\x12.\n\x03\x65lf\x18\x01 \x01(\x0b\x32!.org.solana.sealevel.v1.ELFBinary\x12\x34\n\x08\x66\x65\x61tures\x18\x02 \x01(\x0b\x32\".org.solana.sealevel.v1.FeatureSet\"~\n\x10\x45LFLoaderEffects\x12\x0e\n\x06rodata\x18\x01 \x01(\x0c\x12\x11\n\trodata_sz\x18\x02 \x01(\x04\x12\x10\n\x08text_cnt\x18\x04 \x01(\x04\x12\x10\n\x08text_off\x18\x05 \x01(\x04\x12\x10\n\x08\x65ntry_pc\x18\x06 \x01(\x04\x12\x11\n\tcalldests\x18\x07 \x03(\x04\"\x81\x01\n\x10\x45LFLoaderFixture\x12\x33\n\x05input\x18\x01 \x01(\x0b\x32$.org.solana.sealevel.v1.ELFLoaderCtx\x12\x38\n\x06output\x18\x02 \x01(\x0b\x32(.org.solana.sealevel.v1.ELFLoaderEffects\"G\n\x0fInputDataRegion\x12\x0e\n\x06offset\x18\x01 \x01(\r\x12\x0f\n\x07\x63ontent\x18\x02 \x01(\x0c\x12\x13\n\x0bis_writable\x18\x03 \x01(\x08\"\xcc\x02\n\tVmContext\x12\x10\n\x08heap_max\x18\x01 \x01(\x04\x12\x0e\n\x06rodata\x18\x02 \x01(\x0c\x12\"\n\x1arodata_text_section_offset\x18\x03 \x01(\x04\x12\"\n\x1arodata_text_section_length\x18\x04 \x01(\x04\x12\x43\n\x12input_data_regions\x18\x05 \x03(\x0b\x32\'.org.solana.sealevel.v1.InputDataRegion\x12\n\n\x02r0\x18\x06 \x01(\x04\x12\n\n\x02r1\x18\x07 \x01(\x04\x12\n\n\x02r2\x18\x08 \x01(\x04\x12\n\n\x02r3\x18\t \x01(\x04\x12\n\n\x02r4\x18\n \x01(\x04\x12\n\n\x02r5\x18\x0b \x01(\x04\x12\n\n\x02r6\x18\x0c \x01(\x04\x12\n\n\x02r7\x18\r \x01(\x04\x12\n\n\x02r8\x18\x0e \x01(\x04\x12\n\n\x02r9\x18\x0f \x01(\x04\x12\x0b\n\x03r10\x18\x10 \x01(\x04\x12\x0b\n\x03r11\x18\x11 \x01(\x04\"?\n\x11SyscallInvocation\x12\x15\n\rfunction_name\x18\x01 \x01(\x0c\x12\x13\n\x0bheap_prefix\x18\x02 \x01(\x0c\"\xc3\x01\n\x0eSyscallContext\x12\x31\n\x06vm_ctx\x18\x01 \x01(\x0b\x32!.org.solana.sealevel.v1.VmContext\x12\x37\n\tinstr_ctx\x18\x02 \x01(\x0b\x32$.org.solana.sealevel.v1.InstrContext\x12\x45\n\x12syscall_invocation\x18\x03 \x01(\x0b\x32).org.solana.sealevel.v1.SyscallInvocation\"\x8f\x01\n\x0eSyscallEffects\x12\r\n\x05\x65rror\x18\x01 \x01(\x03\x12\n\n\x02r0\x18\x02 \x01(\x04\x12\x10\n\x08\x63u_avail\x18\x03 \x01(\x04\x12\x0c\n\x04heap\x18\x04 \x01(\x0c\x12\r\n\x05stack\x18\x05 \x01(\x0c\x12\x11\n\tinputdata\x18\x06 \x01(\x0c\x12\x13\n\x0b\x66rame_count\x18\x07 \x01(\x04\x12\x0b\n\x03log\x18\x08 \x01(\x0c\"\x7f\n\x0eSyscallFixture\x12\x35\n\x05input\x18\x01 \x01(\x0b\x32&.org.solana.sealevel.v1.SyscallContext\x12\x36\n\x06output\x18\x02 \x01(\x0b\x32&.org.solana.sealevel.v1.SyscallEffectsb\x06proto3') -) - - - - -_FEATURESET = _descriptor.Descriptor( - name='FeatureSet', - full_name='org.solana.sealevel.v1.FeatureSet', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='features', full_name='org.solana.sealevel.v1.FeatureSet.features', index=0, - number=1, type=6, cpp_type=4, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=40, - serialized_end=70, -) - - -_ACCTSTATE = _descriptor.Descriptor( - name='AcctState', - full_name='org.solana.sealevel.v1.AcctState', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='address', full_name='org.solana.sealevel.v1.AcctState.address', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='lamports', full_name='org.solana.sealevel.v1.AcctState.lamports', index=1, - number=2, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='data', full_name='org.solana.sealevel.v1.AcctState.data', index=2, - number=3, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='executable', full_name='org.solana.sealevel.v1.AcctState.executable', index=3, - number=4, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='rent_epoch', full_name='org.solana.sealevel.v1.AcctState.rent_epoch', index=4, - number=5, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='owner', full_name='org.solana.sealevel.v1.AcctState.owner', index=5, - number=6, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=72, - serialized_end=187, -) - - -_EPOCHCONTEXT = _descriptor.Descriptor( - name='EpochContext', - full_name='org.solana.sealevel.v1.EpochContext', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='features', full_name='org.solana.sealevel.v1.EpochContext.features', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=189, - serialized_end=257, -) - - -_SLOTCONTEXT = _descriptor.Descriptor( - name='SlotContext', - full_name='org.solana.sealevel.v1.SlotContext', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=259, - serialized_end=272, -) - - -_TXNCONTEXT = _descriptor.Descriptor( - name='TxnContext', - full_name='org.solana.sealevel.v1.TxnContext', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=274, - serialized_end=286, + name="invoke.proto", + package="org.solana.sealevel.v1", + syntax="proto3", + serialized_pb=_b( + '\n\x0cinvoke.proto\x12\x16org.solana.sealevel.v1\x1a\rcontext.proto\x1a\ttxn.proto"B\n\tInstrAcct\x12\r\n\x05index\x18\x01 \x01(\r\x12\x13\n\x0bis_writable\x18\x02 \x01(\x08\x12\x11\n\tis_signer\x18\x03 \x01(\x08"ã\x02\n\x0cInstrContext\x12\x12\n\nprogram_id\x18\x01 \x01(\x0c\x123\n\x08accounts\x18\x03 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x129\n\x0einstr_accounts\x18\x04 \x03(\x0b2!.org.solana.sealevel.v1.InstrAcct\x12\x0c\n\x04data\x18\x05 \x01(\x0c\x12\x10\n\x08cu_avail\x18\x06 \x01(\x04\x127\n\x0btxn_context\x18\x07 \x01(\x0b2".org.solana.sealevel.v1.TxnContext\x129\n\x0cslot_context\x18\x08 \x01(\x0b2#.org.solana.sealevel.v1.SlotContext\x12;\n\repoch_context\x18\t \x01(\x0b2$.org.solana.sealevel.v1.EpochContext"\x97\x01\n\x0cInstrEffects\x12\x0e\n\x06result\x18\x01 \x01(\x05\x12\x12\n\ncustom_err\x18\x02 \x01(\r\x12<\n\x11modified_accounts\x18\x03 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x12\x10\n\x08cu_avail\x18\x04 \x01(\x04\x12\x13\n\x0breturn_data\x18\x05 \x01(\x0c"y\n\x0cInstrFixture\x123\n\x05input\x18\x01 \x01(\x0b2$.org.solana.sealevel.v1.InstrContext\x124\n\x06output\x18\x02 \x01(\x0b2$.org.solana.sealevel.v1.InstrEffectsb\x06proto3' + ), + dependencies=[context__pb2.DESCRIPTOR, txn__pb2.DESCRIPTOR], ) - - _INSTRACCT = _descriptor.Descriptor( - name='InstrAcct', - full_name='org.solana.sealevel.v1.InstrAcct', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='index', full_name='org.solana.sealevel.v1.InstrAcct.index', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='is_writable', full_name='org.solana.sealevel.v1.InstrAcct.is_writable', index=1, - number=2, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='is_signer', full_name='org.solana.sealevel.v1.InstrAcct.is_signer', index=2, - number=3, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=288, - serialized_end=354, + name="InstrAcct", + full_name="org.solana.sealevel.v1.InstrAcct", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="index", + full_name="org.solana.sealevel.v1.InstrAcct.index", + index=0, + number=1, + type=13, + cpp_type=3, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="is_writable", + full_name="org.solana.sealevel.v1.InstrAcct.is_writable", + index=1, + number=2, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="is_signer", + full_name="org.solana.sealevel.v1.InstrAcct.is_signer", + index=2, + number=3, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=66, + serialized_end=132, ) - - _INSTRCONTEXT = _descriptor.Descriptor( - name='InstrContext', - full_name='org.solana.sealevel.v1.InstrContext', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='program_id', full_name='org.solana.sealevel.v1.InstrContext.program_id', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='loader_id', full_name='org.solana.sealevel.v1.InstrContext.loader_id', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='accounts', full_name='org.solana.sealevel.v1.InstrContext.accounts', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='instr_accounts', full_name='org.solana.sealevel.v1.InstrContext.instr_accounts', index=3, - number=4, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='data', full_name='org.solana.sealevel.v1.InstrContext.data', index=4, - number=5, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='cu_avail', full_name='org.solana.sealevel.v1.InstrContext.cu_avail', index=5, - number=6, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='txn_context', full_name='org.solana.sealevel.v1.InstrContext.txn_context', index=6, - number=7, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='slot_context', full_name='org.solana.sealevel.v1.InstrContext.slot_context', index=7, - number=8, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='epoch_context', full_name='org.solana.sealevel.v1.InstrContext.epoch_context', index=8, - number=9, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=357, - serialized_end=731, + name="InstrContext", + full_name="org.solana.sealevel.v1.InstrContext", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="program_id", + full_name="org.solana.sealevel.v1.InstrContext.program_id", + index=0, + number=1, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="accounts", + full_name="org.solana.sealevel.v1.InstrContext.accounts", + index=1, + number=3, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="instr_accounts", + full_name="org.solana.sealevel.v1.InstrContext.instr_accounts", + index=2, + number=4, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="data", + full_name="org.solana.sealevel.v1.InstrContext.data", + index=3, + number=5, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="cu_avail", + full_name="org.solana.sealevel.v1.InstrContext.cu_avail", + index=4, + number=6, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="txn_context", + full_name="org.solana.sealevel.v1.InstrContext.txn_context", + index=5, + number=7, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="slot_context", + full_name="org.solana.sealevel.v1.InstrContext.slot_context", + index=6, + number=8, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="epoch_context", + full_name="org.solana.sealevel.v1.InstrContext.epoch_context", + index=7, + number=9, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=135, + serialized_end=490, ) - - _INSTREFFECTS = _descriptor.Descriptor( - name='InstrEffects', - full_name='org.solana.sealevel.v1.InstrEffects', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='result', full_name='org.solana.sealevel.v1.InstrEffects.result', index=0, - number=1, type=5, cpp_type=1, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='custom_err', full_name='org.solana.sealevel.v1.InstrEffects.custom_err', index=1, - number=2, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='modified_accounts', full_name='org.solana.sealevel.v1.InstrEffects.modified_accounts', index=2, - number=3, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='cu_avail', full_name='org.solana.sealevel.v1.InstrEffects.cu_avail', index=3, - number=4, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='return_data', full_name='org.solana.sealevel.v1.InstrEffects.return_data', index=4, - number=5, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=734, - serialized_end=885, + name="InstrEffects", + full_name="org.solana.sealevel.v1.InstrEffects", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="result", + full_name="org.solana.sealevel.v1.InstrEffects.result", + index=0, + number=1, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="custom_err", + full_name="org.solana.sealevel.v1.InstrEffects.custom_err", + index=1, + number=2, + type=13, + cpp_type=3, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="modified_accounts", + full_name="org.solana.sealevel.v1.InstrEffects.modified_accounts", + index=2, + number=3, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="cu_avail", + full_name="org.solana.sealevel.v1.InstrEffects.cu_avail", + index=3, + number=4, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="return_data", + full_name="org.solana.sealevel.v1.InstrEffects.return_data", + index=4, + number=5, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=493, + serialized_end=644, ) - - _INSTRFIXTURE = _descriptor.Descriptor( - name='InstrFixture', - full_name='org.solana.sealevel.v1.InstrFixture', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='input', full_name='org.solana.sealevel.v1.InstrFixture.input', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='output', full_name='org.solana.sealevel.v1.InstrFixture.output', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=887, - serialized_end=1008, -) - - -_ELFBINARY = _descriptor.Descriptor( - name='ELFBinary', - full_name='org.solana.sealevel.v1.ELFBinary', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='data', full_name='org.solana.sealevel.v1.ELFBinary.data', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1010, - serialized_end=1035, -) - - -_ELFLOADERCTX = _descriptor.Descriptor( - name='ELFLoaderCtx', - full_name='org.solana.sealevel.v1.ELFLoaderCtx', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='elf', full_name='org.solana.sealevel.v1.ELFLoaderCtx.elf', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='features', full_name='org.solana.sealevel.v1.ELFLoaderCtx.features', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1037, - serialized_end=1153, -) - - -_ELFLOADEREFFECTS = _descriptor.Descriptor( - name='ELFLoaderEffects', - full_name='org.solana.sealevel.v1.ELFLoaderEffects', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='rodata', full_name='org.solana.sealevel.v1.ELFLoaderEffects.rodata', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='rodata_sz', full_name='org.solana.sealevel.v1.ELFLoaderEffects.rodata_sz', index=1, - number=2, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='text_cnt', full_name='org.solana.sealevel.v1.ELFLoaderEffects.text_cnt', index=2, - number=4, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='text_off', full_name='org.solana.sealevel.v1.ELFLoaderEffects.text_off', index=3, - number=5, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='entry_pc', full_name='org.solana.sealevel.v1.ELFLoaderEffects.entry_pc', index=4, - number=6, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='calldests', full_name='org.solana.sealevel.v1.ELFLoaderEffects.calldests', index=5, - number=7, type=4, cpp_type=4, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1155, - serialized_end=1281, -) - - -_ELFLOADERFIXTURE = _descriptor.Descriptor( - name='ELFLoaderFixture', - full_name='org.solana.sealevel.v1.ELFLoaderFixture', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='input', full_name='org.solana.sealevel.v1.ELFLoaderFixture.input', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='output', full_name='org.solana.sealevel.v1.ELFLoaderFixture.output', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1284, - serialized_end=1413, -) - - -_INPUTDATAREGION = _descriptor.Descriptor( - name='InputDataRegion', - full_name='org.solana.sealevel.v1.InputDataRegion', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='offset', full_name='org.solana.sealevel.v1.InputDataRegion.offset', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='content', full_name='org.solana.sealevel.v1.InputDataRegion.content', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='is_writable', full_name='org.solana.sealevel.v1.InputDataRegion.is_writable', index=2, - number=3, type=8, cpp_type=7, label=1, - has_default_value=False, default_value=False, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1415, - serialized_end=1486, -) - - -_VMCONTEXT = _descriptor.Descriptor( - name='VmContext', - full_name='org.solana.sealevel.v1.VmContext', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='heap_max', full_name='org.solana.sealevel.v1.VmContext.heap_max', index=0, - number=1, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='rodata', full_name='org.solana.sealevel.v1.VmContext.rodata', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='rodata_text_section_offset', full_name='org.solana.sealevel.v1.VmContext.rodata_text_section_offset', index=2, - number=3, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='rodata_text_section_length', full_name='org.solana.sealevel.v1.VmContext.rodata_text_section_length', index=3, - number=4, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='input_data_regions', full_name='org.solana.sealevel.v1.VmContext.input_data_regions', index=4, - number=5, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r0', full_name='org.solana.sealevel.v1.VmContext.r0', index=5, - number=6, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r1', full_name='org.solana.sealevel.v1.VmContext.r1', index=6, - number=7, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r2', full_name='org.solana.sealevel.v1.VmContext.r2', index=7, - number=8, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r3', full_name='org.solana.sealevel.v1.VmContext.r3', index=8, - number=9, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r4', full_name='org.solana.sealevel.v1.VmContext.r4', index=9, - number=10, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r5', full_name='org.solana.sealevel.v1.VmContext.r5', index=10, - number=11, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r6', full_name='org.solana.sealevel.v1.VmContext.r6', index=11, - number=12, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r7', full_name='org.solana.sealevel.v1.VmContext.r7', index=12, - number=13, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r8', full_name='org.solana.sealevel.v1.VmContext.r8', index=13, - number=14, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r9', full_name='org.solana.sealevel.v1.VmContext.r9', index=14, - number=15, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r10', full_name='org.solana.sealevel.v1.VmContext.r10', index=15, - number=16, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r11', full_name='org.solana.sealevel.v1.VmContext.r11', index=16, - number=17, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1489, - serialized_end=1821, -) - - -_SYSCALLINVOCATION = _descriptor.Descriptor( - name='SyscallInvocation', - full_name='org.solana.sealevel.v1.SyscallInvocation', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='function_name', full_name='org.solana.sealevel.v1.SyscallInvocation.function_name', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='heap_prefix', full_name='org.solana.sealevel.v1.SyscallInvocation.heap_prefix', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1823, - serialized_end=1886, -) - - -_SYSCALLCONTEXT = _descriptor.Descriptor( - name='SyscallContext', - full_name='org.solana.sealevel.v1.SyscallContext', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='vm_ctx', full_name='org.solana.sealevel.v1.SyscallContext.vm_ctx', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='instr_ctx', full_name='org.solana.sealevel.v1.SyscallContext.instr_ctx', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='syscall_invocation', full_name='org.solana.sealevel.v1.SyscallContext.syscall_invocation', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=1889, - serialized_end=2084, + name="InstrFixture", + full_name="org.solana.sealevel.v1.InstrFixture", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="input", + full_name="org.solana.sealevel.v1.InstrFixture.input", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="output", + full_name="org.solana.sealevel.v1.InstrFixture.output", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=646, + serialized_end=767, ) - - -_SYSCALLEFFECTS = _descriptor.Descriptor( - name='SyscallEffects', - full_name='org.solana.sealevel.v1.SyscallEffects', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='error', full_name='org.solana.sealevel.v1.SyscallEffects.error', index=0, - number=1, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='r0', full_name='org.solana.sealevel.v1.SyscallEffects.r0', index=1, - number=2, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='cu_avail', full_name='org.solana.sealevel.v1.SyscallEffects.cu_avail', index=2, - number=3, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='heap', full_name='org.solana.sealevel.v1.SyscallEffects.heap', index=3, - number=4, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='stack', full_name='org.solana.sealevel.v1.SyscallEffects.stack', index=4, - number=5, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='inputdata', full_name='org.solana.sealevel.v1.SyscallEffects.inputdata', index=5, - number=6, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='frame_count', full_name='org.solana.sealevel.v1.SyscallEffects.frame_count', index=6, - number=7, type=4, cpp_type=4, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='log', full_name='org.solana.sealevel.v1.SyscallEffects.log', index=7, - number=8, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=2087, - serialized_end=2230, -) - - -_SYSCALLFIXTURE = _descriptor.Descriptor( - name='SyscallFixture', - full_name='org.solana.sealevel.v1.SyscallFixture', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='input', full_name='org.solana.sealevel.v1.SyscallFixture.input', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - _descriptor.FieldDescriptor( - name='output', full_name='org.solana.sealevel.v1.SyscallFixture.output', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None, file=DESCRIPTOR), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=2232, - serialized_end=2359, -) - -_EPOCHCONTEXT.fields_by_name['features'].message_type = _FEATURESET -_INSTRCONTEXT.fields_by_name['accounts'].message_type = _ACCTSTATE -_INSTRCONTEXT.fields_by_name['instr_accounts'].message_type = _INSTRACCT -_INSTRCONTEXT.fields_by_name['txn_context'].message_type = _TXNCONTEXT -_INSTRCONTEXT.fields_by_name['slot_context'].message_type = _SLOTCONTEXT -_INSTRCONTEXT.fields_by_name['epoch_context'].message_type = _EPOCHCONTEXT -_INSTREFFECTS.fields_by_name['modified_accounts'].message_type = _ACCTSTATE -_INSTRFIXTURE.fields_by_name['input'].message_type = _INSTRCONTEXT -_INSTRFIXTURE.fields_by_name['output'].message_type = _INSTREFFECTS -_ELFLOADERCTX.fields_by_name['elf'].message_type = _ELFBINARY -_ELFLOADERCTX.fields_by_name['features'].message_type = _FEATURESET -_ELFLOADERFIXTURE.fields_by_name['input'].message_type = _ELFLOADERCTX -_ELFLOADERFIXTURE.fields_by_name['output'].message_type = _ELFLOADEREFFECTS -_VMCONTEXT.fields_by_name['input_data_regions'].message_type = _INPUTDATAREGION -_SYSCALLCONTEXT.fields_by_name['vm_ctx'].message_type = _VMCONTEXT -_SYSCALLCONTEXT.fields_by_name['instr_ctx'].message_type = _INSTRCONTEXT -_SYSCALLCONTEXT.fields_by_name['syscall_invocation'].message_type = _SYSCALLINVOCATION -_SYSCALLFIXTURE.fields_by_name['input'].message_type = _SYSCALLCONTEXT -_SYSCALLFIXTURE.fields_by_name['output'].message_type = _SYSCALLEFFECTS -DESCRIPTOR.message_types_by_name['FeatureSet'] = _FEATURESET -DESCRIPTOR.message_types_by_name['AcctState'] = _ACCTSTATE -DESCRIPTOR.message_types_by_name['EpochContext'] = _EPOCHCONTEXT -DESCRIPTOR.message_types_by_name['SlotContext'] = _SLOTCONTEXT -DESCRIPTOR.message_types_by_name['TxnContext'] = _TXNCONTEXT -DESCRIPTOR.message_types_by_name['InstrAcct'] = _INSTRACCT -DESCRIPTOR.message_types_by_name['InstrContext'] = _INSTRCONTEXT -DESCRIPTOR.message_types_by_name['InstrEffects'] = _INSTREFFECTS -DESCRIPTOR.message_types_by_name['InstrFixture'] = _INSTRFIXTURE -DESCRIPTOR.message_types_by_name['ELFBinary'] = _ELFBINARY -DESCRIPTOR.message_types_by_name['ELFLoaderCtx'] = _ELFLOADERCTX -DESCRIPTOR.message_types_by_name['ELFLoaderEffects'] = _ELFLOADEREFFECTS -DESCRIPTOR.message_types_by_name['ELFLoaderFixture'] = _ELFLOADERFIXTURE -DESCRIPTOR.message_types_by_name['InputDataRegion'] = _INPUTDATAREGION -DESCRIPTOR.message_types_by_name['VmContext'] = _VMCONTEXT -DESCRIPTOR.message_types_by_name['SyscallInvocation'] = _SYSCALLINVOCATION -DESCRIPTOR.message_types_by_name['SyscallContext'] = _SYSCALLCONTEXT -DESCRIPTOR.message_types_by_name['SyscallEffects'] = _SYSCALLEFFECTS -DESCRIPTOR.message_types_by_name['SyscallFixture'] = _SYSCALLFIXTURE +_INSTRCONTEXT.fields_by_name["accounts"].message_type = context__pb2._ACCTSTATE +_INSTRCONTEXT.fields_by_name["instr_accounts"].message_type = _INSTRACCT +_INSTRCONTEXT.fields_by_name["txn_context"].message_type = txn__pb2._TXNCONTEXT +_INSTRCONTEXT.fields_by_name["slot_context"].message_type = context__pb2._SLOTCONTEXT +_INSTRCONTEXT.fields_by_name["epoch_context"].message_type = context__pb2._EPOCHCONTEXT +_INSTREFFECTS.fields_by_name["modified_accounts"].message_type = context__pb2._ACCTSTATE +_INSTRFIXTURE.fields_by_name["input"].message_type = _INSTRCONTEXT +_INSTRFIXTURE.fields_by_name["output"].message_type = _INSTREFFECTS +DESCRIPTOR.message_types_by_name["InstrAcct"] = _INSTRACCT +DESCRIPTOR.message_types_by_name["InstrContext"] = _INSTRCONTEXT +DESCRIPTOR.message_types_by_name["InstrEffects"] = _INSTREFFECTS +DESCRIPTOR.message_types_by_name["InstrFixture"] = _INSTRFIXTURE _sym_db.RegisterFileDescriptor(DESCRIPTOR) - -FeatureSet = _reflection.GeneratedProtocolMessageType('FeatureSet', (_message.Message,), dict( - DESCRIPTOR = _FEATURESET, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.FeatureSet) - )) -_sym_db.RegisterMessage(FeatureSet) - -AcctState = _reflection.GeneratedProtocolMessageType('AcctState', (_message.Message,), dict( - DESCRIPTOR = _ACCTSTATE, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.AcctState) - )) -_sym_db.RegisterMessage(AcctState) - -EpochContext = _reflection.GeneratedProtocolMessageType('EpochContext', (_message.Message,), dict( - DESCRIPTOR = _EPOCHCONTEXT, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.EpochContext) - )) -_sym_db.RegisterMessage(EpochContext) - -SlotContext = _reflection.GeneratedProtocolMessageType('SlotContext', (_message.Message,), dict( - DESCRIPTOR = _SLOTCONTEXT, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.SlotContext) - )) -_sym_db.RegisterMessage(SlotContext) - -TxnContext = _reflection.GeneratedProtocolMessageType('TxnContext', (_message.Message,), dict( - DESCRIPTOR = _TXNCONTEXT, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.TxnContext) - )) -_sym_db.RegisterMessage(TxnContext) - -InstrAcct = _reflection.GeneratedProtocolMessageType('InstrAcct', (_message.Message,), dict( - DESCRIPTOR = _INSTRACCT, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.InstrAcct) - )) +InstrAcct = _reflection.GeneratedProtocolMessageType( + "InstrAcct", + (_message.Message,), + dict(DESCRIPTOR=_INSTRACCT, __module__="invoke_pb2"), +) _sym_db.RegisterMessage(InstrAcct) - -InstrContext = _reflection.GeneratedProtocolMessageType('InstrContext', (_message.Message,), dict( - DESCRIPTOR = _INSTRCONTEXT, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.InstrContext) - )) +InstrContext = _reflection.GeneratedProtocolMessageType( + "InstrContext", + (_message.Message,), + dict(DESCRIPTOR=_INSTRCONTEXT, __module__="invoke_pb2"), +) _sym_db.RegisterMessage(InstrContext) - -InstrEffects = _reflection.GeneratedProtocolMessageType('InstrEffects', (_message.Message,), dict( - DESCRIPTOR = _INSTREFFECTS, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.InstrEffects) - )) +InstrEffects = _reflection.GeneratedProtocolMessageType( + "InstrEffects", + (_message.Message,), + dict(DESCRIPTOR=_INSTREFFECTS, __module__="invoke_pb2"), +) _sym_db.RegisterMessage(InstrEffects) - -InstrFixture = _reflection.GeneratedProtocolMessageType('InstrFixture', (_message.Message,), dict( - DESCRIPTOR = _INSTRFIXTURE, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.InstrFixture) - )) +InstrFixture = _reflection.GeneratedProtocolMessageType( + "InstrFixture", + (_message.Message,), + dict(DESCRIPTOR=_INSTRFIXTURE, __module__="invoke_pb2"), +) _sym_db.RegisterMessage(InstrFixture) - -ELFBinary = _reflection.GeneratedProtocolMessageType('ELFBinary', (_message.Message,), dict( - DESCRIPTOR = _ELFBINARY, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.ELFBinary) - )) -_sym_db.RegisterMessage(ELFBinary) - -ELFLoaderCtx = _reflection.GeneratedProtocolMessageType('ELFLoaderCtx', (_message.Message,), dict( - DESCRIPTOR = _ELFLOADERCTX, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.ELFLoaderCtx) - )) -_sym_db.RegisterMessage(ELFLoaderCtx) - -ELFLoaderEffects = _reflection.GeneratedProtocolMessageType('ELFLoaderEffects', (_message.Message,), dict( - DESCRIPTOR = _ELFLOADEREFFECTS, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.ELFLoaderEffects) - )) -_sym_db.RegisterMessage(ELFLoaderEffects) - -ELFLoaderFixture = _reflection.GeneratedProtocolMessageType('ELFLoaderFixture', (_message.Message,), dict( - DESCRIPTOR = _ELFLOADERFIXTURE, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.ELFLoaderFixture) - )) -_sym_db.RegisterMessage(ELFLoaderFixture) - -InputDataRegion = _reflection.GeneratedProtocolMessageType('InputDataRegion', (_message.Message,), dict( - DESCRIPTOR = _INPUTDATAREGION, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.InputDataRegion) - )) -_sym_db.RegisterMessage(InputDataRegion) - -VmContext = _reflection.GeneratedProtocolMessageType('VmContext', (_message.Message,), dict( - DESCRIPTOR = _VMCONTEXT, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.VmContext) - )) -_sym_db.RegisterMessage(VmContext) - -SyscallInvocation = _reflection.GeneratedProtocolMessageType('SyscallInvocation', (_message.Message,), dict( - DESCRIPTOR = _SYSCALLINVOCATION, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.SyscallInvocation) - )) -_sym_db.RegisterMessage(SyscallInvocation) - -SyscallContext = _reflection.GeneratedProtocolMessageType('SyscallContext', (_message.Message,), dict( - DESCRIPTOR = _SYSCALLCONTEXT, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.SyscallContext) - )) -_sym_db.RegisterMessage(SyscallContext) - -SyscallEffects = _reflection.GeneratedProtocolMessageType('SyscallEffects', (_message.Message,), dict( - DESCRIPTOR = _SYSCALLEFFECTS, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.SyscallEffects) - )) -_sym_db.RegisterMessage(SyscallEffects) - -SyscallFixture = _reflection.GeneratedProtocolMessageType('SyscallFixture', (_message.Message,), dict( - DESCRIPTOR = _SYSCALLFIXTURE, - __module__ = 'invoke_pb2' - # @@protoc_insertion_point(class_scope:org.solana.sealevel.v1.SyscallFixture) - )) -_sym_db.RegisterMessage(SyscallFixture) - - -# @@protoc_insertion_point(module_scope) diff --git a/src/test_suite/multiprocessing_utils.py b/src/test_suite/multiprocessing_utils.py index 29e0feb..f5a29d8 100644 --- a/src/test_suite/multiprocessing_utils.py +++ b/src/test_suite/multiprocessing_utils.py @@ -1,6 +1,7 @@ from dataclasses import dataclass, field from test_suite.constants import OUTPUT_BUFFER_SIZE -import test_suite.invoke_pb2 as pb +import test_suite.invoke_pb2 as invoke_pb +import test_suite.context_pb2 as context_pb from test_suite.validation_utils import check_account_unchanged import ctypes from ctypes import c_uint64, c_int, POINTER, Structure @@ -12,7 +13,7 @@ def process_target( library: ctypes.CDLL, serialized_instruction_context: str -) -> pb.InstrEffects | None: +) -> invoke_pb.InstrEffects | None: """ Process an instruction through a provided shared library and return the result. @@ -21,7 +22,7 @@ def process_target( - serialized_instruction_context (str): Serialized instruction context message. Returns: - - pb.InstrEffects | None: Result of instruction execution. + - invoke_pb.InstrEffects | None: Result of instruction execution. """ # Define argument and return types @@ -51,7 +52,7 @@ def process_target( # Process the output output_data = bytearray(globals.output_buffer_pointer[: out_sz.value]) - output_object = pb.InstrEffects() + output_object = invoke_pb.InstrEffects() output_object.ParseFromString(output_data) return output_object @@ -261,7 +262,7 @@ def prune_execution_result( instruction_effects.ParseFromString(serialized_instruction_effects) # O(n^2) because not performance sensitive - new_modified_accounts: list[pb.AcctState] = [] + new_modified_accounts: list[context_pb.AcctState] = [] for modified_account in instruction_effects.modified_accounts: account_unchanged = False for beginning_account_state in context.accounts: diff --git a/src/test_suite/serialize_pb2.py b/src/test_suite/serialize_pb2.py new file mode 100644 index 0000000..ee7a3c6 --- /dev/null +++ b/src/test_suite/serialize_pb2.py @@ -0,0 +1,162 @@ +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 + +_sym_db = _symbol_database.Default() +DESCRIPTOR = _descriptor.FileDescriptor( + name="serialize.proto", + package="org.solana.sealevel.v1", + syntax="proto3", + serialized_pb=_b( + '\n\x0fserialize.proto\x12\x16org.solana.sealevel.v1"D\n\x0bVmMemRegion\x12\x0f\n\x07vm_addr\x18\x01 \x01(\x04\x12\x0f\n\x07content\x18\x02 \x01(\x0c\x12\x13\n\x0bis_writable\x18\x03 \x01(\x08"\\\n\x14InstrSerializeResult\x12\x0e\n\x06result\x18\x01 \x01(\x05\x124\n\x07regions\x18\x02 \x03(\x0b2#.org.solana.sealevel.v1.VmMemRegionb\x06proto3' + ), +) +_VMMEMREGION = _descriptor.Descriptor( + name="VmMemRegion", + full_name="org.solana.sealevel.v1.VmMemRegion", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="vm_addr", + full_name="org.solana.sealevel.v1.VmMemRegion.vm_addr", + index=0, + number=1, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="content", + full_name="org.solana.sealevel.v1.VmMemRegion.content", + index=1, + number=2, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="is_writable", + full_name="org.solana.sealevel.v1.VmMemRegion.is_writable", + index=2, + number=3, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=43, + serialized_end=111, +) +_INSTRSERIALIZERESULT = _descriptor.Descriptor( + name="InstrSerializeResult", + full_name="org.solana.sealevel.v1.InstrSerializeResult", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="result", + full_name="org.solana.sealevel.v1.InstrSerializeResult.result", + index=0, + number=1, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="regions", + full_name="org.solana.sealevel.v1.InstrSerializeResult.regions", + index=1, + number=2, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=113, + serialized_end=205, +) +_INSTRSERIALIZERESULT.fields_by_name["regions"].message_type = _VMMEMREGION +DESCRIPTOR.message_types_by_name["VmMemRegion"] = _VMMEMREGION +DESCRIPTOR.message_types_by_name["InstrSerializeResult"] = _INSTRSERIALIZERESULT +_sym_db.RegisterFileDescriptor(DESCRIPTOR) +VmMemRegion = _reflection.GeneratedProtocolMessageType( + "VmMemRegion", + (_message.Message,), + dict(DESCRIPTOR=_VMMEMREGION, __module__="serialize_pb2"), +) +_sym_db.RegisterMessage(VmMemRegion) +InstrSerializeResult = _reflection.GeneratedProtocolMessageType( + "InstrSerializeResult", + (_message.Message,), + dict(DESCRIPTOR=_INSTRSERIALIZERESULT, __module__="serialize_pb2"), +) +_sym_db.RegisterMessage(InstrSerializeResult) diff --git a/src/test_suite/syscall/codec_utils.py b/src/test_suite/syscall/codec_utils.py index 8cc3b0e..ca39746 100644 --- a/src/test_suite/syscall/codec_utils.py +++ b/src/test_suite/syscall/codec_utils.py @@ -1,14 +1,14 @@ import base64 -import test_suite.invoke_pb2 as pb +import test_suite.vm_pb2 as vm_pb -def encode_output(effects: pb.SyscallEffects): +def encode_output(effects: vm_pb.SyscallEffects): """ Encode SyscallEffects fields in-place into human-readable format. Heap is hex, Stack is temp hidden. Args: - - effects (pb.SyscallEffects): Syscall effects (will be modified). + - effects (vm_pb.SyscallEffects): Syscall effects (will be modified). """ effects.heap = base64.b16encode(effects.heap) effects.stack = b"" diff --git a/src/test_suite/test_suite.py b/src/test_suite/test_suite.py index a3bbea5..273c9d8 100644 --- a/src/test_suite/test_suite.py +++ b/src/test_suite/test_suite.py @@ -1,25 +1,20 @@ -from collections import Counter -import functools import shutil from typing import List import typer import ctypes from multiprocessing import Pool from pathlib import Path -from test_suite.constants import LOG_FILE_SEPARATOR_LENGTH, NATIVE_PROGRAM_MAPPING +from test_suite.constants import LOG_FILE_SEPARATOR_LENGTH from test_suite.fixture_utils import ( create_fixture, extract_context_from_fixture, ) -import test_suite.invoke_pb2 as pb -from test_suite.instr.codec_utils import encode_output from test_suite.multiprocessing_utils import ( decode_single_test_case, read_context, initialize_process_output_buffers, process_target, prune_execution_result, - get_feature_pool, run_test, ) import test_suite.globals as globals diff --git a/src/test_suite/txn_pb2.py b/src/test_suite/txn_pb2.py new file mode 100644 index 0000000..2704cba --- /dev/null +++ b/src/test_suite/txn_pb2.py @@ -0,0 +1,1036 @@ +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 + +_sym_db = _symbol_database.Default() +from . import context_pb2 as context__pb2 + +DESCRIPTOR = _descriptor.FileDescriptor( + name="txn.proto", + package="org.solana.sealevel.v1", + syntax="proto3", + serialized_pb=_b( + '\n\ttxn.proto\x12\x16org.solana.sealevel.v1\x1a\rcontext.proto"~\n\rMessageHeader\x12\x1f\n\x17num_required_signatures\x18\x01 \x01(\r\x12$\n\x1cnum_readonly_signed_accounts\x18\x02 \x01(\r\x12&\n\x1enum_readonly_unsigned_accounts\x18\x03 \x01(\r"O\n\x13CompiledInstruction\x12\x18\n\x10program_id_index\x18\x01 \x01(\r\x12\x10\n\x08accounts\x18\x02 \x03(\r\x12\x0c\n\x04data\x18\x03 \x01(\x0c"d\n\x19MessageAddressTableLookup\x12\x13\n\x0baccount_key\x18\x01 \x01(\x0c\x12\x18\n\x10writable_indexes\x18\x02 \x03(\r\x12\x18\n\x10readonly_indexes\x18\x03 \x03(\r"5\n\x0fLoadedAddresses\x12\x10\n\x08writable\x18\x01 \x03(\x0c\x12\x10\n\x08readonly\x18\x02 \x03(\x0c"\x8c\x03\n\x12TransactionMessage\x12\x11\n\tis_legacy\x18\x01 \x01(\x08\x125\n\x06header\x18\x02 \x01(\x0b2%.org.solana.sealevel.v1.MessageHeader\x12\x14\n\x0caccount_keys\x18\x03 \x03(\x0c\x12>\n\x13account_shared_data\x18\x04 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x12A\n\x0cinstructions\x18\x05 \x03(\x0b2+.org.solana.sealevel.v1.CompiledInstruction\x12P\n\x15address_table_lookups\x18\x06 \x03(\x0b21.org.solana.sealevel.v1.MessageAddressTableLookup\x12A\n\x10loaded_addresses\x18\x07 \x01(\x0b2\'.org.solana.sealevel.v1.LoadedAddresses"\x98\x01\n\x14SanitizedTransaction\x12;\n\x07message\x18\x01 \x01(\x0b2*.org.solana.sealevel.v1.TransactionMessage\x12\x14\n\x0cmessage_hash\x18\x02 \x01(\x0c\x12\x19\n\x11is_simple_vote_tx\x18\x03 \x01(\x08\x12\x12\n\nsignatures\x18\x04 \x03(\x0c"è\x01\n\nTxnContext\x128\n\x02tx\x18\x01 \x01(\x0b2,.org.solana.sealevel.v1.SanitizedTransaction\x12\x0f\n\x07max_age\x18\x02 \x01(\x04\x12\x1f\n\x17log_messages_byte_limit\x18\x03 \x01(\x04\x127\n\tepoch_ctx\x18\x04 \x01(\x0b2$.org.solana.sealevel.v1.EpochContext\x125\n\x08slot_ctx\x18\x05 \x01(\x0b2#.org.solana.sealevel.v1.SlotContext"\x9b\x01\n\x0eResultingState\x126\n\x0bacct_states\x18\x01 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x127\n\x0brent_debits\x18\x02 \x03(\x0b2".org.solana.sealevel.v1.RentDebits\x12\x18\n\x10transaction_rent\x18\x03 \x01(\x04"4\n\nRentDebits\x12\x0e\n\x06pubkey\x18\x01 \x01(\x0c\x12\x16\n\x0erent_collected\x18\x02 \x01(\x03"õ\x01\n\tTxnResult\x12\x10\n\x08executed\x18\x01 \x01(\x08\x12\x1a\n\x12sanitization_error\x18\x02 \x01(\x08\x12?\n\x0fresulting_state\x18\x03 \x01(\x0b2&.org.solana.sealevel.v1.ResultingState\x12\x0c\n\x04rent\x18\x04 \x01(\x04\x12\r\n\x05is_ok\x18\x05 \x01(\x08\x12\x0e\n\x06status\x18\x06 \x01(\r\x12\x13\n\x0breturn_data\x18\x07 \x01(\x0c\x12\x16\n\x0eexecuted_units\x18\x08 \x01(\x04\x12\x1f\n\x17accounts_data_len_delta\x18\t \x01(\x03b\x06proto3' + ), + dependencies=[context__pb2.DESCRIPTOR], +) +_MESSAGEHEADER = _descriptor.Descriptor( + name="MessageHeader", + full_name="org.solana.sealevel.v1.MessageHeader", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="num_required_signatures", + full_name="org.solana.sealevel.v1.MessageHeader.num_required_signatures", + index=0, + number=1, + type=13, + cpp_type=3, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="num_readonly_signed_accounts", + full_name="org.solana.sealevel.v1.MessageHeader.num_readonly_signed_accounts", + index=1, + number=2, + type=13, + cpp_type=3, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="num_readonly_unsigned_accounts", + full_name="org.solana.sealevel.v1.MessageHeader.num_readonly_unsigned_accounts", + index=2, + number=3, + type=13, + cpp_type=3, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=52, + serialized_end=178, +) +_COMPILEDINSTRUCTION = _descriptor.Descriptor( + name="CompiledInstruction", + full_name="org.solana.sealevel.v1.CompiledInstruction", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="program_id_index", + full_name="org.solana.sealevel.v1.CompiledInstruction.program_id_index", + index=0, + number=1, + type=13, + cpp_type=3, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="accounts", + full_name="org.solana.sealevel.v1.CompiledInstruction.accounts", + index=1, + number=2, + type=13, + cpp_type=3, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="data", + full_name="org.solana.sealevel.v1.CompiledInstruction.data", + index=2, + number=3, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=180, + serialized_end=259, +) +_MESSAGEADDRESSTABLELOOKUP = _descriptor.Descriptor( + name="MessageAddressTableLookup", + full_name="org.solana.sealevel.v1.MessageAddressTableLookup", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="account_key", + full_name="org.solana.sealevel.v1.MessageAddressTableLookup.account_key", + index=0, + number=1, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="writable_indexes", + full_name="org.solana.sealevel.v1.MessageAddressTableLookup.writable_indexes", + index=1, + number=2, + type=13, + cpp_type=3, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="readonly_indexes", + full_name="org.solana.sealevel.v1.MessageAddressTableLookup.readonly_indexes", + index=2, + number=3, + type=13, + cpp_type=3, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=261, + serialized_end=361, +) +_LOADEDADDRESSES = _descriptor.Descriptor( + name="LoadedAddresses", + full_name="org.solana.sealevel.v1.LoadedAddresses", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="writable", + full_name="org.solana.sealevel.v1.LoadedAddresses.writable", + index=0, + number=1, + type=12, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="readonly", + full_name="org.solana.sealevel.v1.LoadedAddresses.readonly", + index=1, + number=2, + type=12, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=363, + serialized_end=416, +) +_TRANSACTIONMESSAGE = _descriptor.Descriptor( + name="TransactionMessage", + full_name="org.solana.sealevel.v1.TransactionMessage", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="is_legacy", + full_name="org.solana.sealevel.v1.TransactionMessage.is_legacy", + index=0, + number=1, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="header", + full_name="org.solana.sealevel.v1.TransactionMessage.header", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="account_keys", + full_name="org.solana.sealevel.v1.TransactionMessage.account_keys", + index=2, + number=3, + type=12, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="account_shared_data", + full_name="org.solana.sealevel.v1.TransactionMessage.account_shared_data", + index=3, + number=4, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="instructions", + full_name="org.solana.sealevel.v1.TransactionMessage.instructions", + index=4, + number=5, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="address_table_lookups", + full_name="org.solana.sealevel.v1.TransactionMessage.address_table_lookups", + index=5, + number=6, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="loaded_addresses", + full_name="org.solana.sealevel.v1.TransactionMessage.loaded_addresses", + index=6, + number=7, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=419, + serialized_end=815, +) +_SANITIZEDTRANSACTION = _descriptor.Descriptor( + name="SanitizedTransaction", + full_name="org.solana.sealevel.v1.SanitizedTransaction", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="message", + full_name="org.solana.sealevel.v1.SanitizedTransaction.message", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="message_hash", + full_name="org.solana.sealevel.v1.SanitizedTransaction.message_hash", + index=1, + number=2, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="is_simple_vote_tx", + full_name="org.solana.sealevel.v1.SanitizedTransaction.is_simple_vote_tx", + index=2, + number=3, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="signatures", + full_name="org.solana.sealevel.v1.SanitizedTransaction.signatures", + index=3, + number=4, + type=12, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=818, + serialized_end=970, +) +_TXNCONTEXT = _descriptor.Descriptor( + name="TxnContext", + full_name="org.solana.sealevel.v1.TxnContext", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="tx", + full_name="org.solana.sealevel.v1.TxnContext.tx", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="max_age", + full_name="org.solana.sealevel.v1.TxnContext.max_age", + index=1, + number=2, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="log_messages_byte_limit", + full_name="org.solana.sealevel.v1.TxnContext.log_messages_byte_limit", + index=2, + number=3, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="epoch_ctx", + full_name="org.solana.sealevel.v1.TxnContext.epoch_ctx", + index=3, + number=4, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="slot_ctx", + full_name="org.solana.sealevel.v1.TxnContext.slot_ctx", + index=4, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=973, + serialized_end=1205, +) +_RESULTINGSTATE = _descriptor.Descriptor( + name="ResultingState", + full_name="org.solana.sealevel.v1.ResultingState", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="acct_states", + full_name="org.solana.sealevel.v1.ResultingState.acct_states", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="rent_debits", + full_name="org.solana.sealevel.v1.ResultingState.rent_debits", + index=1, + number=2, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="transaction_rent", + full_name="org.solana.sealevel.v1.ResultingState.transaction_rent", + index=2, + number=3, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1208, + serialized_end=1363, +) +_RENTDEBITS = _descriptor.Descriptor( + name="RentDebits", + full_name="org.solana.sealevel.v1.RentDebits", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="pubkey", + full_name="org.solana.sealevel.v1.RentDebits.pubkey", + index=0, + number=1, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="rent_collected", + full_name="org.solana.sealevel.v1.RentDebits.rent_collected", + index=1, + number=2, + type=3, + cpp_type=2, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1365, + serialized_end=1417, +) +_TXNRESULT = _descriptor.Descriptor( + name="TxnResult", + full_name="org.solana.sealevel.v1.TxnResult", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="executed", + full_name="org.solana.sealevel.v1.TxnResult.executed", + index=0, + number=1, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="sanitization_error", + full_name="org.solana.sealevel.v1.TxnResult.sanitization_error", + index=1, + number=2, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="resulting_state", + full_name="org.solana.sealevel.v1.TxnResult.resulting_state", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="rent", + full_name="org.solana.sealevel.v1.TxnResult.rent", + index=3, + number=4, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="is_ok", + full_name="org.solana.sealevel.v1.TxnResult.is_ok", + index=4, + number=5, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="status", + full_name="org.solana.sealevel.v1.TxnResult.status", + index=5, + number=6, + type=13, + cpp_type=3, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="return_data", + full_name="org.solana.sealevel.v1.TxnResult.return_data", + index=6, + number=7, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="executed_units", + full_name="org.solana.sealevel.v1.TxnResult.executed_units", + index=7, + number=8, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="accounts_data_len_delta", + full_name="org.solana.sealevel.v1.TxnResult.accounts_data_len_delta", + index=8, + number=9, + type=3, + cpp_type=2, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1420, + serialized_end=1665, +) +_TRANSACTIONMESSAGE.fields_by_name["header"].message_type = _MESSAGEHEADER +_TRANSACTIONMESSAGE.fields_by_name["account_shared_data"].message_type = ( + context__pb2._ACCTSTATE +) +_TRANSACTIONMESSAGE.fields_by_name["instructions"].message_type = _COMPILEDINSTRUCTION +_TRANSACTIONMESSAGE.fields_by_name["address_table_lookups"].message_type = ( + _MESSAGEADDRESSTABLELOOKUP +) +_TRANSACTIONMESSAGE.fields_by_name["loaded_addresses"].message_type = _LOADEDADDRESSES +_SANITIZEDTRANSACTION.fields_by_name["message"].message_type = _TRANSACTIONMESSAGE +_TXNCONTEXT.fields_by_name["tx"].message_type = _SANITIZEDTRANSACTION +_TXNCONTEXT.fields_by_name["epoch_ctx"].message_type = context__pb2._EPOCHCONTEXT +_TXNCONTEXT.fields_by_name["slot_ctx"].message_type = context__pb2._SLOTCONTEXT +_RESULTINGSTATE.fields_by_name["acct_states"].message_type = context__pb2._ACCTSTATE +_RESULTINGSTATE.fields_by_name["rent_debits"].message_type = _RENTDEBITS +_TXNRESULT.fields_by_name["resulting_state"].message_type = _RESULTINGSTATE +DESCRIPTOR.message_types_by_name["MessageHeader"] = _MESSAGEHEADER +DESCRIPTOR.message_types_by_name["CompiledInstruction"] = _COMPILEDINSTRUCTION +DESCRIPTOR.message_types_by_name["MessageAddressTableLookup"] = ( + _MESSAGEADDRESSTABLELOOKUP +) +DESCRIPTOR.message_types_by_name["LoadedAddresses"] = _LOADEDADDRESSES +DESCRIPTOR.message_types_by_name["TransactionMessage"] = _TRANSACTIONMESSAGE +DESCRIPTOR.message_types_by_name["SanitizedTransaction"] = _SANITIZEDTRANSACTION +DESCRIPTOR.message_types_by_name["TxnContext"] = _TXNCONTEXT +DESCRIPTOR.message_types_by_name["ResultingState"] = _RESULTINGSTATE +DESCRIPTOR.message_types_by_name["RentDebits"] = _RENTDEBITS +DESCRIPTOR.message_types_by_name["TxnResult"] = _TXNRESULT +_sym_db.RegisterFileDescriptor(DESCRIPTOR) +MessageHeader = _reflection.GeneratedProtocolMessageType( + "MessageHeader", + (_message.Message,), + dict(DESCRIPTOR=_MESSAGEHEADER, __module__="txn_pb2"), +) +_sym_db.RegisterMessage(MessageHeader) +CompiledInstruction = _reflection.GeneratedProtocolMessageType( + "CompiledInstruction", + (_message.Message,), + dict(DESCRIPTOR=_COMPILEDINSTRUCTION, __module__="txn_pb2"), +) +_sym_db.RegisterMessage(CompiledInstruction) +MessageAddressTableLookup = _reflection.GeneratedProtocolMessageType( + "MessageAddressTableLookup", + (_message.Message,), + dict(DESCRIPTOR=_MESSAGEADDRESSTABLELOOKUP, __module__="txn_pb2"), +) +_sym_db.RegisterMessage(MessageAddressTableLookup) +LoadedAddresses = _reflection.GeneratedProtocolMessageType( + "LoadedAddresses", + (_message.Message,), + dict(DESCRIPTOR=_LOADEDADDRESSES, __module__="txn_pb2"), +) +_sym_db.RegisterMessage(LoadedAddresses) +TransactionMessage = _reflection.GeneratedProtocolMessageType( + "TransactionMessage", + (_message.Message,), + dict(DESCRIPTOR=_TRANSACTIONMESSAGE, __module__="txn_pb2"), +) +_sym_db.RegisterMessage(TransactionMessage) +SanitizedTransaction = _reflection.GeneratedProtocolMessageType( + "SanitizedTransaction", + (_message.Message,), + dict(DESCRIPTOR=_SANITIZEDTRANSACTION, __module__="txn_pb2"), +) +_sym_db.RegisterMessage(SanitizedTransaction) +TxnContext = _reflection.GeneratedProtocolMessageType( + "TxnContext", + (_message.Message,), + dict(DESCRIPTOR=_TXNCONTEXT, __module__="txn_pb2"), +) +_sym_db.RegisterMessage(TxnContext) +ResultingState = _reflection.GeneratedProtocolMessageType( + "ResultingState", + (_message.Message,), + dict(DESCRIPTOR=_RESULTINGSTATE, __module__="txn_pb2"), +) +_sym_db.RegisterMessage(ResultingState) +RentDebits = _reflection.GeneratedProtocolMessageType( + "RentDebits", + (_message.Message,), + dict(DESCRIPTOR=_RENTDEBITS, __module__="txn_pb2"), +) +_sym_db.RegisterMessage(RentDebits) +TxnResult = _reflection.GeneratedProtocolMessageType( + "TxnResult", (_message.Message,), dict(DESCRIPTOR=_TXNRESULT, __module__="txn_pb2") +) +_sym_db.RegisterMessage(TxnResult) diff --git a/src/test_suite/validation_utils.py b/src/test_suite/validation_utils.py index 0de7ee5..0fe4a73 100644 --- a/src/test_suite/validation_utils.py +++ b/src/test_suite/validation_utils.py @@ -1,12 +1,13 @@ -import test_suite.invoke_pb2 as pb +import test_suite.invoke_pb2 as invoke_pb +import test_suite.context_pb2 as context_pb -def is_valid(instruction_context: pb.InstrContext) -> bool: +def is_valid(instruction_context: invoke_pb.InstrContext) -> bool: """ Checks whether an instruction context message is valid. Args: - - instruction_context (pb.InstrContext): Instruction context message. + - instruction_context (invoke_pb.InstrContext): Instruction context message. Returns: - bool: True if valid, False otherwise. """ @@ -20,13 +21,15 @@ def is_valid(instruction_context: pb.InstrContext) -> bool: return True -def check_account_unchanged(acc1: pb.AcctState, acc2: pb.AcctState) -> bool: +def check_account_unchanged( + acc1: context_pb.AcctState, acc2: context_pb.AcctState +) -> bool: """ Checks whether two account states are equal. Args: - - acc1 (pb.AcctState): Account state message. - - acc2 (pb.AcctState): Account state message. + - acc1 (context_pb.AcctState): Account state message. + - acc2 (context_pb.AcctState): Account state message. Returns: - bool: True if equal, False otherwise. diff --git a/src/test_suite/vm_pb2.py b/src/test_suite/vm_pb2.py new file mode 100644 index 0000000..06af580 --- /dev/null +++ b/src/test_suite/vm_pb2.py @@ -0,0 +1,874 @@ +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 + +_sym_db = _symbol_database.Default() +from . import invoke_pb2 as invoke__pb2 + +DESCRIPTOR = _descriptor.FileDescriptor( + name="vm.proto", + package="org.solana.sealevel.v1", + syntax="proto3", + serialized_pb=_b( + '\n\x08vm.proto\x12\x16org.solana.sealevel.v1\x1a\x0cinvoke.proto"G\n\x0fInputDataRegion\x12\x0e\n\x06offset\x18\x01 \x01(\x04\x12\x0f\n\x07content\x18\x02 \x01(\x0c\x12\x13\n\x0bis_writable\x18\x03 \x01(\x08"Ì\x02\n\tVmContext\x12\x10\n\x08heap_max\x18\x01 \x01(\x04\x12\x0e\n\x06rodata\x18\x02 \x01(\x0c\x12"\n\x1arodata_text_section_offset\x18\x03 \x01(\x04\x12"\n\x1arodata_text_section_length\x18\x04 \x01(\x04\x12C\n\x12input_data_regions\x18\x05 \x03(\x0b2\'.org.solana.sealevel.v1.InputDataRegion\x12\n\n\x02r0\x18\x06 \x01(\x04\x12\n\n\x02r1\x18\x07 \x01(\x04\x12\n\n\x02r2\x18\x08 \x01(\x04\x12\n\n\x02r3\x18\t \x01(\x04\x12\n\n\x02r4\x18\n \x01(\x04\x12\n\n\x02r5\x18\x0b \x01(\x04\x12\n\n\x02r6\x18\x0c \x01(\x04\x12\n\n\x02r7\x18\r \x01(\x04\x12\n\n\x02r8\x18\x0e \x01(\x04\x12\n\n\x02r9\x18\x0f \x01(\x04\x12\x0b\n\x03r10\x18\x10 \x01(\x04\x12\x0b\n\x03r11\x18\x11 \x01(\x04"?\n\x11SyscallInvocation\x12\x15\n\rfunction_name\x18\x01 \x01(\t\x12\x13\n\x0bheap_prefix\x18\x02 \x01(\x0c"Ã\x01\n\x0eSyscallContext\x121\n\x06vm_ctx\x18\x01 \x01(\x0b2!.org.solana.sealevel.v1.VmContext\x127\n\tinstr_ctx\x18\x02 \x01(\x0b2$.org.solana.sealevel.v1.InstrContext\x12E\n\x12syscall_invocation\x18\x03 \x01(\x0b2).org.solana.sealevel.v1.SyscallInvocation"\x8f\x01\n\x0eSyscallEffects\x12\r\n\x05error\x18\x01 \x01(\x03\x12\n\n\x02r0\x18\x02 \x01(\x04\x12\x10\n\x08cu_avail\x18\x03 \x01(\x04\x12\x0c\n\x04heap\x18\x04 \x01(\x0c\x12\r\n\x05stack\x18\x05 \x01(\x0c\x12\x11\n\tinputdata\x18\x06 \x01(\x0c\x12\x13\n\x0bframe_count\x18\x07 \x01(\x04\x12\x0b\n\x03log\x18\x08 \x01(\x0c"\x7f\n\x0eSyscallFixture\x125\n\x05input\x18\x01 \x01(\x0b2&.org.solana.sealevel.v1.SyscallContext\x126\n\x06output\x18\x02 \x01(\x0b2&.org.solana.sealevel.v1.SyscallEffects"4\n\x11ValidateVmEffects\x12\x0e\n\x06result\x18\x01 \x01(\x05\x12\x0f\n\x07success\x18\x02 \x01(\x08b\x06proto3' + ), + dependencies=[invoke__pb2.DESCRIPTOR], +) +_INPUTDATAREGION = _descriptor.Descriptor( + name="InputDataRegion", + full_name="org.solana.sealevel.v1.InputDataRegion", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="offset", + full_name="org.solana.sealevel.v1.InputDataRegion.offset", + index=0, + number=1, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="content", + full_name="org.solana.sealevel.v1.InputDataRegion.content", + index=1, + number=2, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="is_writable", + full_name="org.solana.sealevel.v1.InputDataRegion.is_writable", + index=2, + number=3, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=50, + serialized_end=121, +) +_VMCONTEXT = _descriptor.Descriptor( + name="VmContext", + full_name="org.solana.sealevel.v1.VmContext", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="heap_max", + full_name="org.solana.sealevel.v1.VmContext.heap_max", + index=0, + number=1, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="rodata", + full_name="org.solana.sealevel.v1.VmContext.rodata", + index=1, + number=2, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="rodata_text_section_offset", + full_name="org.solana.sealevel.v1.VmContext.rodata_text_section_offset", + index=2, + number=3, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="rodata_text_section_length", + full_name="org.solana.sealevel.v1.VmContext.rodata_text_section_length", + index=3, + number=4, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="input_data_regions", + full_name="org.solana.sealevel.v1.VmContext.input_data_regions", + index=4, + number=5, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r0", + full_name="org.solana.sealevel.v1.VmContext.r0", + index=5, + number=6, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r1", + full_name="org.solana.sealevel.v1.VmContext.r1", + index=6, + number=7, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r2", + full_name="org.solana.sealevel.v1.VmContext.r2", + index=7, + number=8, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r3", + full_name="org.solana.sealevel.v1.VmContext.r3", + index=8, + number=9, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r4", + full_name="org.solana.sealevel.v1.VmContext.r4", + index=9, + number=10, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r5", + full_name="org.solana.sealevel.v1.VmContext.r5", + index=10, + number=11, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r6", + full_name="org.solana.sealevel.v1.VmContext.r6", + index=11, + number=12, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r7", + full_name="org.solana.sealevel.v1.VmContext.r7", + index=12, + number=13, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r8", + full_name="org.solana.sealevel.v1.VmContext.r8", + index=13, + number=14, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r9", + full_name="org.solana.sealevel.v1.VmContext.r9", + index=14, + number=15, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r10", + full_name="org.solana.sealevel.v1.VmContext.r10", + index=15, + number=16, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r11", + full_name="org.solana.sealevel.v1.VmContext.r11", + index=16, + number=17, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=124, + serialized_end=456, +) +_SYSCALLINVOCATION = _descriptor.Descriptor( + name="SyscallInvocation", + full_name="org.solana.sealevel.v1.SyscallInvocation", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="function_name", + full_name="org.solana.sealevel.v1.SyscallInvocation.function_name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="heap_prefix", + full_name="org.solana.sealevel.v1.SyscallInvocation.heap_prefix", + index=1, + number=2, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=458, + serialized_end=521, +) +_SYSCALLCONTEXT = _descriptor.Descriptor( + name="SyscallContext", + full_name="org.solana.sealevel.v1.SyscallContext", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="vm_ctx", + full_name="org.solana.sealevel.v1.SyscallContext.vm_ctx", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="instr_ctx", + full_name="org.solana.sealevel.v1.SyscallContext.instr_ctx", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="syscall_invocation", + full_name="org.solana.sealevel.v1.SyscallContext.syscall_invocation", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=524, + serialized_end=719, +) +_SYSCALLEFFECTS = _descriptor.Descriptor( + name="SyscallEffects", + full_name="org.solana.sealevel.v1.SyscallEffects", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="error", + full_name="org.solana.sealevel.v1.SyscallEffects.error", + index=0, + number=1, + type=3, + cpp_type=2, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="r0", + full_name="org.solana.sealevel.v1.SyscallEffects.r0", + index=1, + number=2, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="cu_avail", + full_name="org.solana.sealevel.v1.SyscallEffects.cu_avail", + index=2, + number=3, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="heap", + full_name="org.solana.sealevel.v1.SyscallEffects.heap", + index=3, + number=4, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="stack", + full_name="org.solana.sealevel.v1.SyscallEffects.stack", + index=4, + number=5, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="inputdata", + full_name="org.solana.sealevel.v1.SyscallEffects.inputdata", + index=5, + number=6, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="frame_count", + full_name="org.solana.sealevel.v1.SyscallEffects.frame_count", + index=6, + number=7, + type=4, + cpp_type=4, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="log", + full_name="org.solana.sealevel.v1.SyscallEffects.log", + index=7, + number=8, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=722, + serialized_end=865, +) +_SYSCALLFIXTURE = _descriptor.Descriptor( + name="SyscallFixture", + full_name="org.solana.sealevel.v1.SyscallFixture", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="input", + full_name="org.solana.sealevel.v1.SyscallFixture.input", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="output", + full_name="org.solana.sealevel.v1.SyscallFixture.output", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=867, + serialized_end=994, +) +_VALIDATEVMEFFECTS = _descriptor.Descriptor( + name="ValidateVmEffects", + full_name="org.solana.sealevel.v1.ValidateVmEffects", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="result", + full_name="org.solana.sealevel.v1.ValidateVmEffects.result", + index=0, + number=1, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="success", + full_name="org.solana.sealevel.v1.ValidateVmEffects.success", + index=1, + number=2, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=996, + serialized_end=1048, +) +_VMCONTEXT.fields_by_name["input_data_regions"].message_type = _INPUTDATAREGION +_SYSCALLCONTEXT.fields_by_name["vm_ctx"].message_type = _VMCONTEXT +_SYSCALLCONTEXT.fields_by_name["instr_ctx"].message_type = invoke__pb2._INSTRCONTEXT +_SYSCALLCONTEXT.fields_by_name["syscall_invocation"].message_type = _SYSCALLINVOCATION +_SYSCALLFIXTURE.fields_by_name["input"].message_type = _SYSCALLCONTEXT +_SYSCALLFIXTURE.fields_by_name["output"].message_type = _SYSCALLEFFECTS +DESCRIPTOR.message_types_by_name["InputDataRegion"] = _INPUTDATAREGION +DESCRIPTOR.message_types_by_name["VmContext"] = _VMCONTEXT +DESCRIPTOR.message_types_by_name["SyscallInvocation"] = _SYSCALLINVOCATION +DESCRIPTOR.message_types_by_name["SyscallContext"] = _SYSCALLCONTEXT +DESCRIPTOR.message_types_by_name["SyscallEffects"] = _SYSCALLEFFECTS +DESCRIPTOR.message_types_by_name["SyscallFixture"] = _SYSCALLFIXTURE +DESCRIPTOR.message_types_by_name["ValidateVmEffects"] = _VALIDATEVMEFFECTS +_sym_db.RegisterFileDescriptor(DESCRIPTOR) +InputDataRegion = _reflection.GeneratedProtocolMessageType( + "InputDataRegion", + (_message.Message,), + dict(DESCRIPTOR=_INPUTDATAREGION, __module__="vm_pb2"), +) +_sym_db.RegisterMessage(InputDataRegion) +VmContext = _reflection.GeneratedProtocolMessageType( + "VmContext", (_message.Message,), dict(DESCRIPTOR=_VMCONTEXT, __module__="vm_pb2") +) +_sym_db.RegisterMessage(VmContext) +SyscallInvocation = _reflection.GeneratedProtocolMessageType( + "SyscallInvocation", + (_message.Message,), + dict(DESCRIPTOR=_SYSCALLINVOCATION, __module__="vm_pb2"), +) +_sym_db.RegisterMessage(SyscallInvocation) +SyscallContext = _reflection.GeneratedProtocolMessageType( + "SyscallContext", + (_message.Message,), + dict(DESCRIPTOR=_SYSCALLCONTEXT, __module__="vm_pb2"), +) +_sym_db.RegisterMessage(SyscallContext) +SyscallEffects = _reflection.GeneratedProtocolMessageType( + "SyscallEffects", + (_message.Message,), + dict(DESCRIPTOR=_SYSCALLEFFECTS, __module__="vm_pb2"), +) +_sym_db.RegisterMessage(SyscallEffects) +SyscallFixture = _reflection.GeneratedProtocolMessageType( + "SyscallFixture", + (_message.Message,), + dict(DESCRIPTOR=_SYSCALLFIXTURE, __module__="vm_pb2"), +) +_sym_db.RegisterMessage(SyscallFixture) +ValidateVmEffects = _reflection.GeneratedProtocolMessageType( + "ValidateVmEffects", + (_message.Message,), + dict(DESCRIPTOR=_VALIDATEVMEFFECTS, __module__="vm_pb2"), +) +_sym_db.RegisterMessage(ValidateVmEffects)