From cffd03778dd3e1c02966b05ef03af94c31acd778 Mon Sep 17 00:00:00 2001 From: vlad Date: Sat, 21 Mar 2026 10:02:14 +0000 Subject: [PATCH 01/55] Attestation report: embedding validator pubkey --- cmd/secretd/attestation.go | 49 +++++++++++++++++-- cosmwasm/enclaves/execute/Enclave.edl | 2 + .../execute/src/registration/offchain.rs | 24 +++++++-- cosmwasm/packages/sgx-vm/src/attestation.rs | 6 ++- go-cosmwasm/api/bindings.h | 2 +- go-cosmwasm/api/lib.go | 7 ++- go-cosmwasm/api/lib_mock.go | 2 +- go-cosmwasm/src/lib.rs | 15 +++++- 8 files changed, 92 insertions(+), 15 deletions(-) diff --git a/cmd/secretd/attestation.go b/cmd/secretd/attestation.go index de0809c067..2ab31fdda6 100644 --- a/cmd/secretd/attestation.go +++ b/cmd/secretd/attestation.go @@ -35,6 +35,7 @@ const ( flag_no_epid = "no-epid" flag_no_dcap = "no-dcap" flag_is_migration_report = "migration" + flag_unbound_attestation = "unbound-attestation" ) const ( @@ -47,6 +48,47 @@ const ( pulsarRegistrationService = "https://registration-service-testnet.azurewebsites.net/api/registernode" ) +type PrivValidatorKey struct { + PrivKey struct { + Value string `json:"value"` + } `json:"priv_key"` +} + +func CreateAttestationReportEx(cmd *cobra.Command, is_migration_report bool) error { + var ext_sk []byte + + unbound_attestation, _ := cmd.Flags().GetBool(flag_unbound_attestation) + if !unbound_attestation { + path := app.DefaultNodeHome + "/config/priv_validator_key.json" + + data, err := os.ReadFile(path) + if err != nil { + fmt.Errorf("couldn't read the validator key: %w", err) + return err + } + + var key PrivValidatorKey + if err := json.Unmarshal(data, &key); err != nil { + fmt.Errorf("couldn't decode the validator key: %w", err) + return err + } + + decoded, err := base64.StdEncoding.DecodeString(key.PrivKey.Value) + if err != nil { + fmt.Errorf("couldn't decode the validator key: %w", err) + return err + } + + ext_sk = decoded[:32] + } + + _, err := api.CreateAttestationReport(ext_sk, is_migration_report) + if err != nil { + return fmt.Errorf("failed to create attestation report: %w", err) + } + return err +} + func InitAttestation() *cobra.Command { cmd := &cobra.Command{ Use: "init-enclave [output-file]", @@ -96,8 +138,7 @@ blockchain. Writes the certificate in DER format to ~/attestation_cert } is_migration_report, _ := cmd.Flags().GetBool(flag_is_migration_report) - - _, err = api.CreateAttestationReport(is_migration_report) + err = CreateAttestationReportEx(cmd, is_migration_report) if err != nil { return fmt.Errorf("failed to create attestation report: %w", err) } @@ -108,6 +149,7 @@ blockchain. Writes the certificate in DER format to ~/attestation_cert cmd.Flags().Bool(flag_no_epid, false, "Optional flag to disable EPID attestation") cmd.Flags().Bool(flag_no_dcap, false, "Optional flag to disable DCAP attestation") cmd.Flags().Bool(flag_is_migration_report, false, "Create migration report rather then attestation") + cmd.Flags().Bool(flag_unbound_attestation, false, "Optional flag to disable attestation to user binding") return cmd } @@ -490,7 +532,7 @@ Please report any issues with this command } } - _, err = api.CreateAttestationReport(false) + err = CreateAttestationReportEx(cmd, false) if err != nil { return fmt.Errorf("failed to create attestation report: %w", err) } @@ -638,6 +680,7 @@ Please report any issues with this command cmd.Flags().Bool(flag_no_epid, false, "Optional flag to disable EPID attestation") cmd.Flags().Bool(flag_no_dcap, false, "Optional flag to disable DCAP attestation") + cmd.Flags().Bool(flag_unbound_attestation, false, "Optional flag to disable attestation to user binding") return cmd } diff --git a/cosmwasm/enclaves/execute/Enclave.edl b/cosmwasm/enclaves/execute/Enclave.edl index b26ac9ae55..1f756c85fc 100644 --- a/cosmwasm/enclaves/execute/Enclave.edl +++ b/cosmwasm/enclaves/execute/Enclave.edl @@ -57,6 +57,8 @@ enclave { ); public sgx_status_t ecall_get_attestation_report( + [in, count=n_sk] const uint8_t* p_sk, + uint32_t n_sk, uint32_t flags ); diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index a2fd8cb22a..6be313856e 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -339,8 +339,12 @@ fn get_verified_migration_report_body(check_ppid_wl: bool) -> SgxResult sgx_status_t { - let mut report_data: [u8; 48] = [0; 48]; +pub unsafe extern "C" fn ecall_get_attestation_report( + p_sk: *const u8, + n_sk: u32, + flags: u32, +) -> sgx_status_t { + let mut report_data = [0_u8; sgx_types::SGX_REPORT_DATA_SIZE]; let (kp, is_migration_report) = match 0x10 & flags { 0x10 => { @@ -370,7 +374,19 @@ pub unsafe extern "C" fn ecall_get_attestation_report(flags: u32) -> sgx_status_ }; let attestation = { - report_data[0..32].copy_from_slice(&kp.get_pubkey()); + let pk_len = 32 as usize; + report_data[0..pk_len].copy_from_slice(&kp.get_pubkey()); + + if n_sk == 32 { + let sk = ed25519_dalek::SecretKey::from_bytes(std::slice::from_raw_parts( + p_sk, + n_sk as usize, + )) + .unwrap(); + + let pk = ed25519_dalek::PublicKey::from(&sk); + report_data[pk_len..pk_len + pk_len].copy_from_slice(&pk.to_bytes()); + } match get_attestation_report_dcap(&report_data) { Ok(x) => x, @@ -555,7 +571,7 @@ pub unsafe extern "C" fn ecall_migration_op(opcode: u32) -> sgx_types::sgx_statu println!("Create self migration report"); export_local_migration_report(); - ecall_get_attestation_report(0x10) // migration + ecall_get_attestation_report(core::ptr::null(), 0, 0x10) // migration } 2 => { println!("Export encrypted data to the next aurhorized enclave"); diff --git a/cosmwasm/packages/sgx-vm/src/attestation.rs b/cosmwasm/packages/sgx-vm/src/attestation.rs index 345564f9da..0b7e5fd4fb 100644 --- a/cosmwasm/packages/sgx-vm/src/attestation.rs +++ b/cosmwasm/packages/sgx-vm/src/attestation.rs @@ -10,6 +10,8 @@ extern "C" { pub fn ecall_get_attestation_report( eid: sgx_enclave_id_t, retval: *mut sgx_status_t, + p_sk: *const u8, + n_sk: u32, flags: u32, ) -> sgx_status_t; pub fn ecall_authenticate_new_node( @@ -30,7 +32,7 @@ extern "C" { ) -> sgx_status_t; } -pub fn create_attestation_report_u(flags: u32) -> SgxResult<()> { +pub fn create_attestation_report_u(p_sk: *const u8, n_sk: u32, flags: u32) -> SgxResult<()> { // Bind the token to a local variable to ensure its // destructor runs in the end of the function let enclave_access_token = ENCLAVE_DOORBELL @@ -40,7 +42,7 @@ pub fn create_attestation_report_u(flags: u32) -> SgxResult<()> { let eid = enclave.geteid(); let mut retval = sgx_status_t::SGX_SUCCESS; - let status = unsafe { ecall_get_attestation_report(eid, &mut retval, flags) }; + let status = unsafe { ecall_get_attestation_report(eid, &mut retval, p_sk, n_sk, flags) }; if status != sgx_status_t::SGX_SUCCESS { return Err(status); diff --git a/go-cosmwasm/api/bindings.h b/go-cosmwasm/api/bindings.h index 7b0baceaf7..da247ef60e 100644 --- a/go-cosmwasm/api/bindings.h +++ b/go-cosmwasm/api/bindings.h @@ -156,7 +156,7 @@ void configure_enclave_runtime(EnclaveRuntimeConfig config, Buffer *err); Buffer create(cache_t *cache, Buffer wasm, Buffer *err); -bool create_attestation_report(uint32_t flags, Buffer *err); +bool create_attestation_report(Buffer sk, uint32_t flags, Buffer *err); bool emergency_approve_upgrade(Buffer data_dir, Buffer msg); diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index bd6e57c235..1527dd978d 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -507,7 +507,7 @@ func KeyGen() ([]byte, error) { } // CreateAttestationReport Send request to enclave -func CreateAttestationReport(is_migration_report bool) (bool, error) { +func CreateAttestationReport(ext_sk []byte, is_migration_report bool) (bool, error) { errmsg := C.Buffer{} flags := u32(0) @@ -515,7 +515,10 @@ func CreateAttestationReport(is_migration_report bool) (bool, error) { flags |= u32(0x10) } - _, err := C.create_attestation_report(flags, &errmsg) + skSlice := sendSlice(ext_sk) + defer freeAfterSend(skSlice) + + _, err := C.create_attestation_report(skSlice, flags, &errmsg) if err != nil { return false, errorWithMessage(err, errmsg) } diff --git a/go-cosmwasm/api/lib_mock.go b/go-cosmwasm/api/lib_mock.go index c14de5c7dc..ef60843ebb 100644 --- a/go-cosmwasm/api/lib_mock.go +++ b/go-cosmwasm/api/lib_mock.go @@ -272,7 +272,7 @@ func KeyGen() ([]byte, error) { } // KeyGen Seng KeyGen request to enclave -func CreateAttestationReport(is_migration_report bool) (bool, error) { +func CreateAttestationReport(ext_sk []byte, is_migration_report bool) (bool, error) { //errmsg := C.Buffer{} //_, err := C.create_attestation_report(&errmsg) //if err != nil { diff --git a/go-cosmwasm/src/lib.rs b/go-cosmwasm/src/lib.rs index b7293ff1ae..6e541c1e19 100644 --- a/go-cosmwasm/src/lib.rs +++ b/go-cosmwasm/src/lib.rs @@ -164,8 +164,19 @@ pub extern "C" fn init_node( } #[no_mangle] -pub extern "C" fn create_attestation_report(flags: u32, err: Option<&mut Buffer>) -> bool { - if let Err(status) = create_attestation_report_u(flags) { +pub extern "C" fn create_attestation_report( + sk: Buffer, + flags: u32, + err: Option<&mut Buffer>, +) -> bool { + let sk_slice = match unsafe { sk.read() } { + None => &[], + Some(r) => r, + }; + + if let Err(status) = + create_attestation_report_u(sk_slice.as_ptr(), sk_slice.len() as u32, flags) + { set_error(Error::enclave_err(status.to_string()), err); return false; } From 43386a631ea4208e1e5bae383b3b6232220ce89a Mon Sep 17 00:00:00 2001 From: vlad Date: Sat, 21 Mar 2026 11:49:11 +0000 Subject: [PATCH 02/55] misc --- .../execute/src/registration/offchain.rs | 2 +- .../execute/src/registration/onchain.rs | 21 ++++++++++++------- .../execute/src/registration/seed_exchange.rs | 6 +++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index 6be313856e..fe20117420 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -490,7 +490,7 @@ pub unsafe extern "C" fn ecall_get_genesis_seed( ); let seeds = KEY_MANAGER.get_consensus_seed().unwrap(); - let res: Vec = encrypt_seed(target_public_key, &seeds.arr[0], true) + let res: Vec = encrypt_seed(&target_public_key, &seeds.arr[0], true) .map_err(|_| sgx_status_t::SGX_ERROR_UNEXPECTED)?; Ok(res) diff --git a/cosmwasm/enclaves/execute/src/registration/onchain.rs b/cosmwasm/enclaves/execute/src/registration/onchain.rs index c1c6dee1e9..9422efb7dc 100644 --- a/cosmwasm/enclaves/execute/src/registration/onchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/onchain.rs @@ -18,6 +18,7 @@ use sgx_types::sgx_ql_qv_result_t; use enclave_crypto::consts::SELF_REPORT_BODY; use super::seed_exchange::encrypt_seed; +use std::convert::TryInto; use std::slice; #[cfg(feature = "light-client-validation")] @@ -40,7 +41,7 @@ fn get_current_block_time_s() -> i64 { fn verify_attestation_dcap( attestation: &AttestationCombined, - pub_key: &mut [u8; 32], + report_data: &mut sgx_types::sgx_report_data_t, ) -> NodeAuthResult { let tm_s = get_current_block_time_s(); trace!("Current block time: {}", tm_s); @@ -68,7 +69,9 @@ fn verify_attestation_dcap( return NodeAuthResult::MrEnclaveMismatch; } - pub_key.copy_from_slice(&report_body.report_data.d[..32]); + report_data + .d + .copy_from_slice(&report_body.report_data.d[..32]); NodeAuthResult::Success } @@ -110,8 +113,6 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( return NodeAuthResult::SignatureInvalid; } - let mut target_public_key: [u8; 32] = [0u8; 32]; - let attestation = AttestationCombined::from_blob(cert, cert_len as usize); if attestation.quote.is_empty() || attestation.coll.is_empty() { @@ -119,15 +120,19 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( return NodeAuthResult::InvalidCert; } - let res = verify_attestation_dcap(&attestation, &mut target_public_key); + let mut report_data = sgx_types::sgx_report_data_t::default(); + + let res = verify_attestation_dcap(&attestation, &mut report_data); if NodeAuthResult::Success != res { return res; } + let target_public_key: &[u8; 32] = report_data.d[0..32].try_into().unwrap(); + let result = panic::catch_unwind(|| -> Result, NodeAuthResult> { trace!( - "ecall_get_encrypted_seed target_public_key key pk: {:?}", - &target_public_key.to_vec() + "ecall_get_encrypted_seed target_public_key key pk: {}", + hex::encode(target_public_key) ); let seeds = KEY_MANAGER.get_consensus_seed().unwrap(); @@ -150,7 +155,7 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( if let Ok(res) = result { match res { Ok(res) => { - trace!("Done encrypting seed, got {:?}, {:?}", res.len(), res); + trace!("Done encrypting seed, got {}", hex::encode(&res)); let actual_size = res.len() as u32; *p_seeds_size = actual_size; diff --git a/cosmwasm/enclaves/execute/src/registration/seed_exchange.rs b/cosmwasm/enclaves/execute/src/registration/seed_exchange.rs index bc2661c134..df1f6166b9 100644 --- a/cosmwasm/enclaves/execute/src/registration/seed_exchange.rs +++ b/cosmwasm/enclaves/execute/src/registration/seed_exchange.rs @@ -7,7 +7,7 @@ use enclave_ffi_types::SINGLE_ENCRYPTED_SEED_SIZE; use enclave_utils::{Keychain, KEY_MANAGER}; pub fn encrypt_seed( - new_node_pk: [u8; PUBLIC_KEY_SIZE], + new_node_pk: &[u8; PUBLIC_KEY_SIZE], seed_to_share: &Seed, is_legacy: bool, ) -> SgxResult> { @@ -21,9 +21,9 @@ pub fn encrypt_seed( KEY_MANAGER.seed_exchange_key().unwrap() }; - let shared_enc_key = base_seed.diffie_hellman(&new_node_pk); + let shared_enc_key = base_seed.diffie_hellman(new_node_pk); - let authenticated_data: Vec<&[u8]> = vec![&new_node_pk]; + let authenticated_data: Vec<&[u8]> = vec![new_node_pk]; // encrypt the seed using the symmetric key derived in the previous stage // genesis seed is passed in registration From 9c51d01ac905ae41b5109edb2597d16efa4162aa Mon Sep 17 00:00:00 2001 From: vlad Date: Sat, 21 Mar 2026 12:11:31 +0000 Subject: [PATCH 03/55] register_new_node - returning embedded owner pubkey --- cosmwasm/enclaves/execute/Enclave.edl | 3 ++- .../execute/src/registration/onchain.rs | 5 +++++ cosmwasm/packages/sgx-vm/src/attestation.rs | 17 ++++++++++++++--- go-cosmwasm/api/bindings.h | 2 +- go-cosmwasm/api/lib.go | 6 +++--- go-cosmwasm/api/lib_mock.go | 4 ++-- go-cosmwasm/src/lib.rs | 15 +++++++++------ .../internal/keeper/enclave/enclave.go | 2 +- .../internal/keeper/enclave_interface.go | 2 +- x/registration/internal/keeper/mock/enclave.go | 4 ++-- 10 files changed, 40 insertions(+), 20 deletions(-) diff --git a/cosmwasm/enclaves/execute/Enclave.edl b/cosmwasm/enclaves/execute/Enclave.edl index 1f756c85fc..738f8f9267 100644 --- a/cosmwasm/enclaves/execute/Enclave.edl +++ b/cosmwasm/enclaves/execute/Enclave.edl @@ -67,7 +67,8 @@ enclave { uintptr_t cert_len, [out, count=n_seeds] uint8_t* p_seeds, uintptr_t n_seeds, - [out] uintptr_t* p_seeds_size + [out] uintptr_t* p_seeds_size, + [out, count=32] uint8_t* p_owner ); public NodeAuthResult ecall_check_patch_level( diff --git a/cosmwasm/enclaves/execute/src/registration/onchain.rs b/cosmwasm/enclaves/execute/src/registration/onchain.rs index 9422efb7dc..3324f349e3 100644 --- a/cosmwasm/enclaves/execute/src/registration/onchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/onchain.rs @@ -97,6 +97,7 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( p_seeds: *mut u8, n_seeds: u32, p_seeds_size: *mut u32, + p_owner: *mut u8, ) -> NodeAuthResult { if let Err(_err) = oom_handler::register_oom_handler() { error!("Could not register OOM handler!"); @@ -104,6 +105,7 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( } validate_mut_ptr!(p_seeds, n_seeds as usize, NodeAuthResult::InvalidInput); + validate_mut_ptr!(p_owner, 32 as usize, NodeAuthResult::InvalidInput); validate_const_ptr!(cert, cert_len as usize, NodeAuthResult::InvalidInput); let cert_slice = std::slice::from_raw_parts(cert, cert_len as usize); @@ -168,6 +170,9 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( slice::from_raw_parts_mut(p_seeds, res.len()).copy_from_slice(&res); trace!("returning with seed: {}, {}", res.len(), hex::encode(&res)); + + slice::from_raw_parts_mut(p_owner, 32).copy_from_slice(&report_data.d[32..]); + NodeAuthResult::Success } Err(e) => { diff --git a/cosmwasm/packages/sgx-vm/src/attestation.rs b/cosmwasm/packages/sgx-vm/src/attestation.rs index 0b7e5fd4fb..0bdd4ac034 100644 --- a/cosmwasm/packages/sgx-vm/src/attestation.rs +++ b/cosmwasm/packages/sgx-vm/src/attestation.rs @@ -22,6 +22,7 @@ extern "C" { p_seeds: *mut u8, n_seeds: u32, p_seeds_size: *mut u32, + p_owner: *mut u8, ) -> sgx_status_t; pub fn ecall_get_genesis_seed( eid: sgx_enclave_id_t, @@ -55,7 +56,9 @@ pub fn create_attestation_report_u(p_sk: *const u8, n_sk: u32, flags: u32) -> Sg Ok(()) } -pub fn untrusted_get_encrypted_seed(cert: &[u8]) -> SgxResult, NodeAuthResult>> { +pub fn untrusted_get_encrypted_seed( + cert: &[u8], +) -> SgxResult, Vec), NodeAuthResult>> { // Bind the token to a local variable to ensure its // destructor runs in the end of the function let enclave_access_token = ENCLAVE_DOORBELL @@ -69,6 +72,7 @@ pub fn untrusted_get_encrypted_seed(cert: &[u8]) -> SgxResult, No seed_buffer.resize(SINGLE_ENCRYPTED_SEED_SIZE * 100, 0); // should be enough. Resize in later version, when approaching the limit let mut seeds_size: u32 = 0; + let mut owner = [0_u8; 32]; let status = unsafe { ecall_authenticate_new_node( @@ -79,6 +83,7 @@ pub fn untrusted_get_encrypted_seed(cert: &[u8]) -> SgxResult, No seed_buffer.as_mut_ptr(), seed_buffer.len() as u32, &mut seeds_size, + owner.as_mut_ptr(), ) }; @@ -98,10 +103,16 @@ pub fn untrusted_get_encrypted_seed(cert: &[u8]) -> SgxResult, No } seed_buffer.resize(seeds_size as usize, 0); - debug!("Done auth, got seed: {}", hex::encode(&seed_buffer)); - Ok(Ok(seed_buffer)) + let is_ownerzero = owner.iter().all(|&x| x == 0); + let owner_arr = if is_ownerzero { + Vec::new() + } else { + owner.to_vec() + }; + + Ok(Ok((seed_buffer, owner_arr))) } pub fn untrusted_get_encrypted_genesis_seed( diff --git a/go-cosmwasm/api/bindings.h b/go-cosmwasm/api/bindings.h index da247ef60e..f9260f072a 100644 --- a/go-cosmwasm/api/bindings.h +++ b/go-cosmwasm/api/bindings.h @@ -166,7 +166,7 @@ Buffer get_code(cache_t *cache, Buffer id, Buffer *err); Buffer get_encrypted_genesis_seed(Buffer pk, Buffer *err); -Buffer get_encrypted_seed(Buffer cert, Buffer *err); +TwoBuffers get_encrypted_seed(Buffer cert, Buffer *err); Buffer get_health_check(Buffer *err); diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index 1527dd978d..4f86807029 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -525,15 +525,15 @@ func CreateAttestationReport(ext_sk []byte, is_migration_report bool) (bool, err return true, nil } -func GetEncryptedSeed(cert []byte) ([]byte, error) { +func GetEncryptedSeed(cert []byte) ([]byte, []byte, error) { errmsg := C.Buffer{} certSlice := sendSlice(cert) defer freeAfterSend(certSlice) res, err := C.get_encrypted_seed(certSlice, &errmsg) if err != nil { - return nil, errorWithMessage(err, errmsg) + return nil, nil, errorWithMessage(err, errmsg) } - return receiveVector(res), nil + return receiveVector(res.buf1), receiveVector(res.buf2), nil } func GetEncryptedGenesisSeed(pk []byte) ([]byte, error) { diff --git a/go-cosmwasm/api/lib_mock.go b/go-cosmwasm/api/lib_mock.go index ef60843ebb..05084b8fc8 100644 --- a/go-cosmwasm/api/lib_mock.go +++ b/go-cosmwasm/api/lib_mock.go @@ -285,7 +285,7 @@ func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { return nil, nil } -func GetEncryptedSeed(cert []byte) ([]byte, error) { +func GetEncryptedSeed(cert []byte) ([]byte, []byte, error) { //errmsg := C.Buffer{} //certSlice := sendSlice(cert) //defer freeAfterSend(certSlice) @@ -294,7 +294,7 @@ func GetEncryptedSeed(cert []byte) ([]byte, error) { // return nil, errorWithMessage(err, errmsg) //} //return receiveVector(res), nil - return nil, nil + return nil, nil, nil } func GetEncryptedGenesisSeed(cert []byte) ([]byte, error) { diff --git a/go-cosmwasm/src/lib.rs b/go-cosmwasm/src/lib.rs index 6e541c1e19..1fc077c0bd 100644 --- a/go-cosmwasm/src/lib.rs +++ b/go-cosmwasm/src/lib.rs @@ -68,12 +68,12 @@ pub extern "C" fn get_health_check(err: Option<&mut Buffer>) -> Buffer { } #[no_mangle] -pub extern "C" fn get_encrypted_seed(cert: Buffer, err: Option<&mut Buffer>) -> Buffer { +pub extern "C" fn get_encrypted_seed(cert: Buffer, err: Option<&mut Buffer>) -> TwoBuffers { trace!("Called get_encrypted_seed"); let cert_slice = match unsafe { cert.read() } { None => { set_error(Error::empty_arg("attestation_cert"), err); - return Buffer::default(); + return TwoBuffers::default(); } Some(r) => r, }; @@ -82,16 +82,19 @@ pub extern "C" fn get_encrypted_seed(cert: Buffer, err: Option<&mut Buffer>) -> Err(e) => { // An error happened in the SGX sdk. set_error(Error::enclave_err(e.to_string()), err); - Buffer::default() + TwoBuffers::default() } Ok(Err(e)) => { // An error was returned from the enclave. set_error(Error::enclave_err(e.to_string()), err); - Buffer::default() + TwoBuffers::default() } - Ok(Ok(seed)) => { + Ok(Ok((seed, owner))) => { clear_error(); - Buffer::from_vec(seed.to_vec()) + TwoBuffers { + buf1: Buffer::from_vec(seed.to_vec()), + buf2: Buffer::from_vec(owner.to_vec()), + } } } } diff --git a/x/registration/internal/keeper/enclave/enclave.go b/x/registration/internal/keeper/enclave/enclave.go index 3613c11fcf..eeb9639504 100644 --- a/x/registration/internal/keeper/enclave/enclave.go +++ b/x/registration/internal/keeper/enclave/enclave.go @@ -10,7 +10,7 @@ func (Api) LoadSeed(masterKey []byte, seed []byte) (bool, error) { return api.LoadSeedToEnclave(masterKey, seed) } -func (Api) GetEncryptedSeed(masterCert []byte) ([]byte, error) { +func (Api) GetEncryptedSeed(masterCert []byte) ([]byte, []byte, error) { return api.GetEncryptedSeed(masterCert) } diff --git a/x/registration/internal/keeper/enclave_interface.go b/x/registration/internal/keeper/enclave_interface.go index d5f1181761..59c026fda3 100644 --- a/x/registration/internal/keeper/enclave_interface.go +++ b/x/registration/internal/keeper/enclave_interface.go @@ -2,6 +2,6 @@ package keeper type EnclaveInterface interface { LoadSeed(masterKey []byte, seed []byte) (bool, error) - GetEncryptedSeed(masterCert []byte) ([]byte, error) + GetEncryptedSeed(masterCert []byte) ([]byte, []byte, error) GetEncryptedGenesisSeed(pk []byte) ([]byte, error) } diff --git a/x/registration/internal/keeper/mock/enclave.go b/x/registration/internal/keeper/mock/enclave.go index 053d81851e..548cca98a6 100644 --- a/x/registration/internal/keeper/mock/enclave.go +++ b/x/registration/internal/keeper/mock/enclave.go @@ -8,8 +8,8 @@ func (MockEnclaveApi) LoadSeed(_ []byte, _ []byte) (bool, error) { return true, nil } -func (MockEnclaveApi) GetEncryptedSeed(_ []byte) ([]byte, error) { - return []byte(""), nil +func (MockEnclaveApi) GetEncryptedSeed(_ []byte) ([]byte, []byte, error) { + return []byte(""), nil, nil } func (MockEnclaveApi) GetEncryptedGenesisSeed(_ []byte) ([]byte, error) { From e982e1614d871c3b5c8239f236e8eb12dbbf4d0e Mon Sep 17 00:00:00 2001 From: vlad Date: Sat, 21 Mar 2026 15:41:37 +0000 Subject: [PATCH 04/55] build fix --- x/registration/internal/keeper/keeper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/registration/internal/keeper/keeper.go b/x/registration/internal/keeper/keeper.go index 9170ab4a4a..d8a5fcaed8 100644 --- a/x/registration/internal/keeper/keeper.go +++ b/x/registration/internal/keeper/keeper.go @@ -149,7 +149,7 @@ func (k Keeper) RegisterNode(ctx sdk.Context, certificate ra.Certificate) ([]byt return k.getRegistrationInfo(ctx, publicKey).EncryptedSeed, nil } - encSeed, err = k.enclave.GetEncryptedSeed(certificate) + encSeed, _, err = k.enclave.GetEncryptedSeed(certificate) if err != nil { // return 0, errorsmod.Wrap(err, "cosmwasm create") return nil, errorsmod.Wrap(types.ErrAuthenticateFailed, err.Error()) From db1e8885956da9aed46a171cababd540cb9dcfac Mon Sep 17 00:00:00 2001 From: vlad Date: Sat, 21 Mar 2026 15:43:15 +0000 Subject: [PATCH 05/55] register_new_node: returning both owner and machine_id --- cosmwasm/enclaves/execute/Enclave.edl | 2 +- .../execute/src/registration/attestation.rs | 38 ++++++++----- .../src/registration/check_patch_level.rs | 6 +-- .../execute/src/registration/offchain.rs | 4 +- .../execute/src/registration/onchain.rs | 53 ++++++++++--------- cosmwasm/packages/sgx-vm/src/attestation.rs | 2 +- 6 files changed, 60 insertions(+), 45 deletions(-) diff --git a/cosmwasm/enclaves/execute/Enclave.edl b/cosmwasm/enclaves/execute/Enclave.edl index 738f8f9267..231d0ef1e3 100644 --- a/cosmwasm/enclaves/execute/Enclave.edl +++ b/cosmwasm/enclaves/execute/Enclave.edl @@ -68,7 +68,7 @@ enclave { [out, count=n_seeds] uint8_t* p_seeds, uintptr_t n_seeds, [out] uintptr_t* p_seeds_size, - [out, count=32] uint8_t* p_owner + [out, count=52] uint8_t* p_owner ); public NodeAuthResult ecall_check_patch_level( diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index eaa534aac0..80d9817810 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -657,11 +657,17 @@ impl AttestationCombined { } } +pub struct VerifiedSgxQuote { + pub body: sgx_report_body_t, + pub qv_result: sgx_ql_qv_result_t, + pub machine_id_hash: Option<[u8; 20]>, +} + pub fn verify_quote_sgx( attestation: &AttestationCombined, time_s: i64, check_ppid_wl: bool, -) -> Result<(sgx_report_body_t, sgx_ql_qv_result_t), sgx_status_t> { +) -> sgx_types::SgxResult { let qv_result = verify_quote_any(&attestation.quote, &attestation.coll, time_s)?; if attestation.quote.len() < mem::size_of::() { @@ -677,21 +683,25 @@ pub fn verify_quote_sgx( trace!("Unrecognized quote version: {}", version); Err(sgx_status_t::SGX_ERROR_UNEXPECTED) } else { - let report_body = (*my_p_quote).report_body; - if !attestation.verify_fmspc() { return Err(sgx_status_t::SGX_ERROR_UNEXPECTED); } - let is_in_wl = match attestation.extract_cpu_cert() { - Some(ppid) => { - let ppid_addr = crate::registration::offchain::calculate_truncated_hash(&ppid); + let machine_id_opt = if let Some(ppid) = attestation.extract_cpu_cert() { + Some(crate::registration::offchain::calculate_truncated_hash( + &ppid, + )) + } else { + None + }; + let is_in_wl = match &machine_id_opt { + Some(machine_id_hash) => { let wl = PPID_WHITELIST.lock().unwrap(); - if wl.contains(&ppid_addr) { + if wl.contains(machine_id_hash) { true } else { - println!("Unknown Machine ID: {}", orig_hex::encode(ppid_addr)); + println!("Unknown Machine ID: {}", orig_hex::encode(machine_id_hash)); false } } @@ -715,7 +725,11 @@ pub fn verify_quote_sgx( return Err(sgx_status_t::SGX_ERROR_UNEXPECTED); } - Ok((report_body, qv_result)) + Ok(VerifiedSgxQuote { + body: (*my_p_quote).report_body, + qv_result: qv_result, + machine_id_hash: machine_id_opt, + }) } } } @@ -857,11 +871,11 @@ pub fn get_quote_ecdsa(pub_k: &[u8]) -> Result { + Ok(res) => { trace!("Self quote verified ok"); - if r.1 != sgx_ql_qv_result_t::SGX_QL_QV_RESULT_OK { + if res.qv_result != sgx_ql_qv_result_t::SGX_QL_QV_RESULT_OK { // TODO: strict policy wrt own quote verification - trace!("WARNING: {}", r.1); + trace!("WARNING: {}", res.qv_result); } } Err(e) => { diff --git a/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs b/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs index c09593b01d..50966289fa 100644 --- a/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs +++ b/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs @@ -43,9 +43,9 @@ unsafe fn check_patch_level_dcap(pub_k: &[u8; 32]) -> (NodeAuthResult, Option { match verify_quote_sgx(&attestation, 0, false) { - Ok(r) => { - if r.1 != sgx_ql_qv_result_t::SGX_QL_QV_RESULT_OK { - println!("WARNING: {}", r.1); + Ok(res) => { + if res.qv_result != sgx_ql_qv_result_t::SGX_QL_QV_RESULT_OK { + println!("WARNING: {}", res.qv_result); } let ppid = attestation.extract_cpu_cert(); diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index fe20117420..2007088d0e 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -312,8 +312,8 @@ fn get_verified_migration_report_body(check_ppid_wl: bool) -> SgxResult { - return Ok(body); + Ok(res) => { + return Ok(res.body); } Err(e) => { error!("Can't verify remote quote: {}", e); diff --git a/cosmwasm/enclaves/execute/src/registration/onchain.rs b/cosmwasm/enclaves/execute/src/registration/onchain.rs index 3324f349e3..c809e964f5 100644 --- a/cosmwasm/enclaves/execute/src/registration/onchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/onchain.rs @@ -6,7 +6,7 @@ use std::panic; use enclave_ffi_types::NodeAuthResult; -use crate::registration::attestation::{verify_quote_sgx, AttestationCombined}; +use crate::registration::attestation::{verify_quote_sgx, AttestationCombined, VerifiedSgxQuote}; use enclave_utils::{ oom_handler::{self, get_then_clear_oom_happened}, @@ -41,39 +41,34 @@ fn get_current_block_time_s() -> i64 { fn verify_attestation_dcap( attestation: &AttestationCombined, - report_data: &mut sgx_types::sgx_report_data_t, -) -> NodeAuthResult { +) -> Result { let tm_s = get_current_block_time_s(); trace!("Current block time: {}", tm_s); - let report_body = match verify_quote_sgx(attestation, tm_s, true) { - Ok(r) => { + let res = match verify_quote_sgx(attestation, tm_s, true) { + Ok(res) => { trace!("Remote quote verified ok"); - if r.1 != sgx_ql_qv_result_t::SGX_QL_QV_RESULT_OK { - trace!("WARNING: {}", r.1); + if res.qv_result != sgx_ql_qv_result_t::SGX_QL_QV_RESULT_OK { + trace!("WARNING: {}", res.qv_result); } - r.0 + res } Err(e) => { trace!("Remote quote verification failed: {}", e); - return NodeAuthResult::InvalidCert; + return Err(NodeAuthResult::InvalidCert); } }; - if (report_body.mr_enclave.m) != SELF_REPORT_BODY.mr_enclave.m { + if (res.body.mr_enclave.m) != SELF_REPORT_BODY.mr_enclave.m { error!( "mrenclave expected={}, actual={}", hex::encode(SELF_REPORT_BODY.mr_enclave.m), - hex::encode(report_body.mr_enclave.m) + hex::encode(res.body.mr_enclave.m) ); - return NodeAuthResult::MrEnclaveMismatch; + return Err(NodeAuthResult::MrEnclaveMismatch); } - report_data - .d - .copy_from_slice(&report_body.report_data.d[..32]); - - NodeAuthResult::Success + Ok(res) } /// @@ -105,7 +100,7 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( } validate_mut_ptr!(p_seeds, n_seeds as usize, NodeAuthResult::InvalidInput); - validate_mut_ptr!(p_owner, 32 as usize, NodeAuthResult::InvalidInput); + validate_mut_ptr!(p_owner, 52 as usize, NodeAuthResult::InvalidInput); validate_const_ptr!(cert, cert_len as usize, NodeAuthResult::InvalidInput); let cert_slice = std::slice::from_raw_parts(cert, cert_len as usize); @@ -122,14 +117,14 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( return NodeAuthResult::InvalidCert; } - let mut report_data = sgx_types::sgx_report_data_t::default(); - - let res = verify_attestation_dcap(&attestation, &mut report_data); - if NodeAuthResult::Success != res { - return res; - } + let verified_quote = match verify_attestation_dcap(&attestation) { + Ok(res) => res, + Err(e) => { + return e; + } + }; - let target_public_key: &[u8; 32] = report_data.d[0..32].try_into().unwrap(); + let target_public_key: &[u8; 32] = verified_quote.body.report_data.d[0..32].try_into().unwrap(); let result = panic::catch_unwind(|| -> Result, NodeAuthResult> { trace!( @@ -171,7 +166,13 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( trace!("returning with seed: {}, {}", res.len(), hex::encode(&res)); - slice::from_raw_parts_mut(p_owner, 32).copy_from_slice(&report_data.d[32..]); + slice::from_raw_parts_mut(p_owner, 32) + .copy_from_slice(&verified_quote.body.report_data.d[32..]); + + if let Some(machine_id_hash) = verified_quote.machine_id_hash { + slice::from_raw_parts_mut(p_owner.add(32), 20) + .copy_from_slice(&machine_id_hash); + } NodeAuthResult::Success } diff --git a/cosmwasm/packages/sgx-vm/src/attestation.rs b/cosmwasm/packages/sgx-vm/src/attestation.rs index 0bdd4ac034..5e2c6614e9 100644 --- a/cosmwasm/packages/sgx-vm/src/attestation.rs +++ b/cosmwasm/packages/sgx-vm/src/attestation.rs @@ -72,7 +72,7 @@ pub fn untrusted_get_encrypted_seed( seed_buffer.resize(SINGLE_ENCRYPTED_SEED_SIZE * 100, 0); // should be enough. Resize in later version, when approaching the limit let mut seeds_size: u32 = 0; - let mut owner = [0_u8; 32]; + let mut owner = [0_u8; 52]; let status = unsafe { ecall_authenticate_new_node( From 21bf156a7c2e4e5d0d49428cedfdf64e806ed9d0 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 30 Mar 2026 12:05:07 +0000 Subject: [PATCH 06/55] allow_list refactor, both m->o and o->m --- .../execute/src/registration/attestation.rs | 102 +++++++++++++++++- .../execute/src/registration/offchain.rs | 6 +- 2 files changed, 101 insertions(+), 7 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index 80d9817810..66a987992a 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -106,6 +106,91 @@ impl KnownJwtKeys { } } +pub mod allow_list { + + use std::collections::{BTreeMap, HashMap}; + + pub const MACHINE_ID_LEN: usize = 20; + pub const OWNER_LEN: usize = 32; + + pub type MachineID = [u8; MACHINE_ID_LEN]; + pub type Owner = [u8; OWNER_LEN]; + + pub struct Data { + pub m_to_o: HashMap<[u8; 20], [u8; 32]>, + pub o_to_m: HashMap<[u8; 32], BTreeMap<[u8; 20], u64>>, + } + + impl Data { + fn update_o_to_m(&mut self, owner: &Owner, machine: &MachineID, add: bool, height: u64) { + if *owner == [0u8; OWNER_LEN] { + return; + } + + let should_remove = { + let owned_machines = self.o_to_m.entry(*owner).or_default(); + + if add { + owned_machines.insert(*machine, height); + } else { + owned_machines.remove(machine); + } + + owned_machines.is_empty() + }; + + if should_remove { + self.o_to_m.remove(owner); + } + } + + pub fn update( + &mut self, + machine: &MachineID, + owner: &Owner, + machine_pop: &MachineID, + height: u64, + ) -> Option<(MachineID, Owner)> { + let (prev_owner, prev_machine) = if let Some(prev_owner) = self.m_to_o.get_mut(machine) + { + let prev_owner_val = *prev_owner; + *prev_owner = *owner; // update existing machine + (prev_owner_val, *machine) + } else { + // machine is new. Remove this owner's old machine + let old_machine = { + let owned_machines = match self.o_to_m.get(owner) { + Some(x) => x, + None => { + return None; // no old machines + } + }; + + if owned_machines.contains_key(machine_pop) { + machine_pop // use hint, the machine the owner wants to remove + } else { + // find the oldest machine + match owned_machines.iter().min_by_key(|(_, height)| *height) { + Some((machine, _)) => machine, + None => return None, + } + } + }; + + self.m_to_o.remove(old_machine); // remove old machine + self.m_to_o.insert(*machine, *owner); // insert new machine + + (*owner, *old_machine) + }; + + self.update_o_to_m(&prev_owner, &prev_machine, false, 0_u64); + self.update_o_to_m(owner, machine, true, height); + + Some((prev_machine, prev_owner)) + } + } +} + lazy_static::lazy_static! { static ref KNOWN_JWT_KEYS: KnownJwtKeys = { @@ -140,7 +225,7 @@ lazy_static::lazy_static! { keys }; - pub static ref PPID_WHITELIST: SgxMutex> = { + pub static ref PPID_WHITELIST: SgxMutex = { let mut set: HashSet<[u8; 20]> = HashSet::new(); set.insert([0x01,0x50,0x7c,0x95,0x77,0x89,0xb7,0xc1,0xaf,0xde,0x97,0x2d,0x67,0xf1,0xfd,0xd5,0x3a,0xf1,0xa8,0xda]); @@ -287,7 +372,16 @@ lazy_static::lazy_static! { set.insert([0xfe,0xc9,0x34,0x2e,0x9e,0xe4,0x18,0x64,0x53,0xf8,0xa7,0xe0,0x27,0xfa,0xc8,0xc2,0x4e,0x7c,0x0c,0x60]); set.insert([0xff,0xf4,0xfe,0x67,0xc5,0x2b,0x8d,0x0d,0x42,0x5d,0x2b,0x97,0x72,0xe7,0xa4,0xff,0xcd,0x9d,0xac,0xf3]); - SgxMutex::new(set) + let mut ret = allow_list::Data { + m_to_o: HashMap::new(), + o_to_m: HashMap::new(), + }; + + for x in set { + ret.m_to_o.insert(x, [0_u8; 32]); + } + + SgxMutex::new(ret) }; static ref FMSPC_EOL: HashSet<&'static str> = HashSet::from([ @@ -660,7 +754,7 @@ impl AttestationCombined { pub struct VerifiedSgxQuote { pub body: sgx_report_body_t, pub qv_result: sgx_ql_qv_result_t, - pub machine_id_hash: Option<[u8; 20]>, + pub machine_id_hash: Option, } pub fn verify_quote_sgx( @@ -698,7 +792,7 @@ pub fn verify_quote_sgx( let is_in_wl = match &machine_id_opt { Some(machine_id_hash) => { let wl = PPID_WHITELIST.lock().unwrap(); - if wl.contains(machine_id_hash) { + if wl.m_to_o.contains_key(machine_id_hash) { true } else { println!("Unknown Machine ID: {}", orig_hex::encode(machine_id_hash)); diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index 2007088d0e..b859217b5a 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -886,15 +886,15 @@ pub unsafe extern "C" fn ecall_onchain_approve_machine_id( } { - let mut set = crate::registration::attestation::PPID_WHITELIST + let mut allow_list = crate::registration::attestation::PPID_WHITELIST .lock() .unwrap(); let arg: &[u8; 20] = machine_id.try_into().unwrap(); - if !set.contains(arg) { + if !allow_list.m_to_o.contains_key(arg) { println!("Onchain added machine ID: {}", hex::encode(arg)); - set.insert(*arg); + allow_list.m_to_o.insert(*arg, [0_u8; 32]); } } From 1bfb09b33a4fd2d1e0212f9c6bc315dcb71acf3c Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 30 Mar 2026 13:55:29 +0000 Subject: [PATCH 07/55] ecall_authenticate_new_node: updating allow_list state --- cosmwasm/enclaves/execute/Enclave.edl | 3 +- .../execute/src/registration/onchain.rs | 78 +++++++++++++++---- cosmwasm/packages/sgx-vm/src/attestation.rs | 17 ++-- 3 files changed, 76 insertions(+), 22 deletions(-) diff --git a/cosmwasm/enclaves/execute/Enclave.edl b/cosmwasm/enclaves/execute/Enclave.edl index 231d0ef1e3..1a0e841ef3 100644 --- a/cosmwasm/enclaves/execute/Enclave.edl +++ b/cosmwasm/enclaves/execute/Enclave.edl @@ -68,7 +68,8 @@ enclave { [out, count=n_seeds] uint8_t* p_seeds, uintptr_t n_seeds, [out] uintptr_t* p_seeds_size, - [out, count=52] uint8_t* p_owner + [in, count=20] const uint8_t* p_machine_pop, + [out, count=104] uint8_t* p_machine_del_add ); public NodeAuthResult ecall_check_patch_level( diff --git a/cosmwasm/enclaves/execute/src/registration/onchain.rs b/cosmwasm/enclaves/execute/src/registration/onchain.rs index c809e964f5..0181150447 100644 --- a/cosmwasm/enclaves/execute/src/registration/onchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/onchain.rs @@ -6,7 +6,9 @@ use std::panic; use enclave_ffi_types::NodeAuthResult; -use crate::registration::attestation::{verify_quote_sgx, AttestationCombined, VerifiedSgxQuote}; +use crate::registration::attestation::{ + allow_list, verify_quote_sgx, AttestationCombined, VerifiedSgxQuote, +}; use enclave_utils::{ oom_handler::{self, get_then_clear_oom_happened}, @@ -71,6 +73,20 @@ fn verify_attestation_dcap( Ok(res) } +unsafe fn copy_machine_data_res( + p_machine_data: *mut u8, + machine: &allow_list::MachineID, + owner: &allow_list::Owner, +) { + slice::from_raw_parts_mut(p_machine_data, allow_list::OWNER_LEN).copy_from_slice(owner); + + slice::from_raw_parts_mut( + p_machine_data.add(allow_list::OWNER_LEN), + allow_list::MACHINE_ID_LEN, + ) + .copy_from_slice(machine); +} + /// /// `ecall_authenticate_new_node` /// @@ -92,15 +108,27 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( p_seeds: *mut u8, n_seeds: u32, p_seeds_size: *mut u32, - p_owner: *mut u8, + p_machine_pop: *const u8, + p_machine_del_add: *mut u8, ) -> NodeAuthResult { if let Err(_err) = oom_handler::register_oom_handler() { error!("Could not register OOM handler!"); return NodeAuthResult::MemorySafetyAllocationError; } + let machine_data = allow_list::OWNER_LEN + allow_list::MACHINE_ID_LEN; + validate_mut_ptr!(p_seeds, n_seeds as usize, NodeAuthResult::InvalidInput); - validate_mut_ptr!(p_owner, 52 as usize, NodeAuthResult::InvalidInput); + validate_const_ptr!( + p_machine_pop, + allow_list::MACHINE_ID_LEN, + NodeAuthResult::InvalidInput + ); + validate_mut_ptr!( + p_machine_del_add, + machine_data * 2, + NodeAuthResult::InvalidInput + ); validate_const_ptr!(cert, cert_len as usize, NodeAuthResult::InvalidInput); let cert_slice = std::slice::from_raw_parts(cert, cert_len as usize); @@ -152,8 +180,6 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( if let Ok(res) = result { match res { Ok(res) => { - trace!("Done encrypting seed, got {}", hex::encode(&res)); - let actual_size = res.len() as u32; *p_seeds_size = actual_size; @@ -162,18 +188,42 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( return NodeAuthResult::InvalidInput; } - slice::from_raw_parts_mut(p_seeds, res.len()).copy_from_slice(&res); - - trace!("returning with seed: {}, {}", res.len(), hex::encode(&res)); - - slice::from_raw_parts_mut(p_owner, 32) - .copy_from_slice(&verified_quote.body.report_data.d[32..]); - if let Some(machine_id_hash) = verified_quote.machine_id_hash { - slice::from_raw_parts_mut(p_owner.add(32), 20) - .copy_from_slice(&machine_id_hash); + // handle changes to the SGX allow-list + let mut allow_list = crate::registration::attestation::PPID_WHITELIST + .lock() + .unwrap(); + + let owner: &allow_list::Owner = + &verified_quote.body.report_data.d[32..].try_into().unwrap(); + + let machine_pop: &allow_list::MachineID = + slice::from_raw_parts(p_machine_pop, allow_list::MACHINE_ID_LEN) + .try_into() + .unwrap(); + + let height = { + let extra = KEY_MANAGER.extra_data.lock().unwrap(); + extra.height + }; + + // if swap-res failed - never mind. This is probably because the machine was added with proof-of-cloud + if let Some(swap_res) = + allow_list.update(&machine_id_hash, owner, machine_pop, height) + { + copy_machine_data_res( + p_machine_del_add.add(machine_data), + &machine_id_hash, + owner, + ); + + copy_machine_data_res(p_machine_del_add, &swap_res.0, &swap_res.1); + } } + slice::from_raw_parts_mut(p_seeds, res.len()).copy_from_slice(&res); + trace!("returning with seed: {}, {}", res.len(), hex::encode(&res)); + NodeAuthResult::Success } Err(e) => { diff --git a/cosmwasm/packages/sgx-vm/src/attestation.rs b/cosmwasm/packages/sgx-vm/src/attestation.rs index 5e2c6614e9..845135488b 100644 --- a/cosmwasm/packages/sgx-vm/src/attestation.rs +++ b/cosmwasm/packages/sgx-vm/src/attestation.rs @@ -22,7 +22,8 @@ extern "C" { p_seeds: *mut u8, n_seeds: u32, p_seeds_size: *mut u32, - p_owner: *mut u8, + p_machine_pop: *const u8, + p_machine_del_add: *mut u8, ) -> sgx_status_t; pub fn ecall_get_genesis_seed( eid: sgx_enclave_id_t, @@ -72,7 +73,8 @@ pub fn untrusted_get_encrypted_seed( seed_buffer.resize(SINGLE_ENCRYPTED_SEED_SIZE * 100, 0); // should be enough. Resize in later version, when approaching the limit let mut seeds_size: u32 = 0; - let mut owner = [0_u8; 52]; + let mut machine_pop = [0_u8; 20]; + let mut machine_add_del = [0_u8; 104]; let status = unsafe { ecall_authenticate_new_node( @@ -83,7 +85,8 @@ pub fn untrusted_get_encrypted_seed( seed_buffer.as_mut_ptr(), seed_buffer.len() as u32, &mut seeds_size, - owner.as_mut_ptr(), + machine_pop.as_ptr(), + machine_add_del.as_mut_ptr(), ) }; @@ -105,14 +108,14 @@ pub fn untrusted_get_encrypted_seed( seed_buffer.resize(seeds_size as usize, 0); debug!("Done auth, got seed: {}", hex::encode(&seed_buffer)); - let is_ownerzero = owner.iter().all(|&x| x == 0); - let owner_arr = if is_ownerzero { + let is_machine_data_zero = machine_add_del.iter().all(|&x| x == 0); + let machine_data_arr = if is_machine_data_zero { Vec::new() } else { - owner.to_vec() + machine_add_del.to_vec() }; - Ok(Ok((seed_buffer, owner_arr))) + Ok(Ok((seed_buffer, machine_data_arr))) } pub fn untrusted_get_encrypted_genesis_seed( From 44baa28a1fd8d4a021078cae2da0ceff265d4ee1 Mon Sep 17 00:00:00 2001 From: vlad Date: Tue, 31 Mar 2026 13:33:09 +0000 Subject: [PATCH 08/55] compute module keeper access to reg keeper --- app/keepers/keepers.go | 1 + x/compute/internal/keeper/keeper.go | 4 ++++ x/compute/internal/keeper/test_common.go | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 10c6976c4f..3dc958096f 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -539,6 +539,7 @@ func (ak *SecretAppKeepers) InitCustomKeepers( ak.TransferKeeper, ak.IbcKeeper.ChannelKeeper, ak.IbcSwitchKeeper, + *ak.RegKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), computeDir, diff --git a/x/compute/internal/keeper/keeper.go b/x/compute/internal/keeper/keeper.go index d224fc1394..a7dbb8fae1 100644 --- a/x/compute/internal/keeper/keeper.go +++ b/x/compute/internal/keeper/keeper.go @@ -56,6 +56,7 @@ import ( v1wasmTypes "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types/v1" cronkeeper "github.com/scrtlabs/SecretNetwork/x/cron/keeper" + "github.com/scrtlabs/SecretNetwork/x/registration" "github.com/scrtlabs/SecretNetwork/x/compute/internal/types" @@ -84,6 +85,7 @@ type Keeper struct { bankKeeper bankkeeper.Keeper portKeeper portkeeper.Keeper capabilityKeeper capabilitykeeper.ScopedKeeper + regKeeper registration.Keeper cronKeeper cronkeeper.Keeper wasmer wasm.Wasmer queryPlugins QueryPlugins @@ -123,6 +125,7 @@ func NewKeeper( portSource types.ICS20TransferPortSource, channelKeeper channelkeeper.Keeper, ics4Wrapper porttypes.ICS4Wrapper, + regKeeper registration.Keeper, msgRouter MessageRouter, queryRouter GRPCQueryRouter, homeDir string, @@ -148,6 +151,7 @@ func NewKeeper( cronKeeper: cronKeeper, portKeeper: portKeeper, capabilityKeeper: capabilityKeeper, + regKeeper: regKeeper, messenger: NewMessageHandler( msgRouter, customEncoders, diff --git a/x/compute/internal/keeper/test_common.go b/x/compute/internal/keeper/test_common.go index 5d5033c3ae..6e3650fd8d 100644 --- a/x/compute/internal/keeper/test_common.go +++ b/x/compute/internal/keeper/test_common.go @@ -581,6 +581,15 @@ func CreateTestInput(t *testing.T, isCheckTx bool, supportedFeatures string, enc // stakingtypes.RegisterMsgServer(serviceRouter, stakingMsgServer) // distrtypes.RegisterMsgServer(serviceRouter, distrMsgServer) + regKeeper := registration.NewKeeper( + encodingConfig.Codec, + runtime.NewKVStoreService(keys[registration.StoreKey]), + msgRouter, + registration.EnclaveApi{}, + tempDir, + false, + ) + bappTxMngr := baseapp.LastMsgMarkerContainer{} keeper := NewKeeper( @@ -600,6 +609,7 @@ func CreateTestInput(t *testing.T, isCheckTx bool, supportedFeatures string, enc MockIBCTransferKeeper{}, ibcKeeper.ChannelKeeper, nil, + regKeeper, msgRouter, queryRouter, tempDir, From 38425337b4f42e6c4a3a0066887e41d2ccaaf724 Mon Sep 17 00:00:00 2001 From: vlad Date: Sun, 5 Apr 2026 12:39:07 +0000 Subject: [PATCH 09/55] machine-swap via enclave --- app/app.go | 1 + cosmwasm/enclaves/execute/Enclave.edl | 12 +- .../execute/src/registration/attestation.rs | 77 +++++++----- .../execute/src/registration/offchain.rs | 119 ++++++++++++------ .../execute/src/registration/onchain.rs | 14 +-- cosmwasm/packages/sgx-vm/src/attestation.rs | 2 +- cosmwasm/packages/sgx-vm/src/lib.rs | 3 +- cosmwasm/packages/sgx-vm/src/seed.rs | 57 +++++++-- go-cosmwasm/api/bindings.h | 4 +- go-cosmwasm/api/lib.go | 21 +++- go-cosmwasm/api/lib_mock.go | 6 +- go-cosmwasm/src/lib.rs | 40 ++++-- x/compute/internal/keeper/keeper.go | 27 ---- x/compute/internal/keeper/msg_server.go | 8 +- x/registration/internal/keeper/keeper.go | 76 +++++++++-- x/registration/internal/types/keys.go | 2 + 16 files changed, 324 insertions(+), 145 deletions(-) diff --git a/app/app.go b/app/app.go index d2ff3a58fa..ee8cf7c9b3 100644 --- a/app/app.go +++ b/app/app.go @@ -511,6 +511,7 @@ func (app *SecretNetworkApp) Initialize() { ctx := sdk.NewContext(ms, cmtproto.Header{}, false, app.Logger()) _ = app.AppKeepers.ComputeKeeper.SetEnclaveColdEvidences(ctx) + _ = app.AppKeepers.RegKeeper.SetEnclaveColdData(ctx) app.UpdateNetworkKeys() } diff --git a/cosmwasm/enclaves/execute/Enclave.edl b/cosmwasm/enclaves/execute/Enclave.edl index 1a0e841ef3..81415c68cf 100644 --- a/cosmwasm/enclaves/execute/Enclave.edl +++ b/cosmwasm/enclaves/execute/Enclave.edl @@ -51,9 +51,15 @@ enclave { public sgx_status_t ecall_onchain_approve_machine_id( [in, count=n_id] const uint8_t* p_id, - uint32_t n_id, - [in, out, count=32] uint8_t* p_proof, - bool is_on_chain + uint32_t n_id + ); + + public sgx_status_t ecall_submit_machine_swap( + uint32_t index, + [in, count=n_machine_info] const uint8_t* p_machine_info, + uint32_t n_machine_info, + [in, count=n_proof] const uint8_t* p_proof, + uint32_t n_proof ); public sgx_status_t ecall_get_attestation_report( diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index 66a987992a..61a62567c3 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -108,7 +108,7 @@ impl KnownJwtKeys { pub mod allow_list { - use std::collections::{BTreeMap, HashMap}; + use std::collections::HashMap; pub const MACHINE_ID_LEN: usize = 20; pub const OWNER_LEN: usize = 32; @@ -117,12 +117,12 @@ pub mod allow_list { pub type Owner = [u8; OWNER_LEN]; pub struct Data { - pub m_to_o: HashMap<[u8; 20], [u8; 32]>, - pub o_to_m: HashMap<[u8; 32], BTreeMap<[u8; 20], u64>>, + pub m_to_o: HashMap, + pub o_to_m: HashMap>, } impl Data { - fn update_o_to_m(&mut self, owner: &Owner, machine: &MachineID, add: bool, height: u64) { + fn update_o_to_m(&mut self, owner: &Owner, machine: &MachineID, add: bool) { if *owner == [0u8; OWNER_LEN] { return; } @@ -131,9 +131,11 @@ pub mod allow_list { let owned_machines = self.o_to_m.entry(*owner).or_default(); if add { - owned_machines.insert(*machine, height); + owned_machines.push(*machine); } else { - owned_machines.remove(machine); + if let Some(pos) = owned_machines.iter().position(|x| x == machine) { + owned_machines.remove(pos); + } } owned_machines.is_empty() @@ -149,44 +151,57 @@ pub mod allow_list { machine: &MachineID, owner: &Owner, machine_pop: &MachineID, - height: u64, ) -> Option<(MachineID, Owner)> { - let (prev_owner, prev_machine) = if let Some(prev_owner) = self.m_to_o.get_mut(machine) - { - let prev_owner_val = *prev_owner; - *prev_owner = *owner; // update existing machine - (prev_owner_val, *machine) + let prev_owner_opt = if let Some(prev_owner_ref) = self.m_to_o.get_mut(machine) { + let prev_owner_val = *prev_owner_ref; + *prev_owner_ref = *owner; // update existing machine + + Some(prev_owner_val) + } else { + None + }; + + if let Some(prev_owner) = prev_owner_opt { + self.update_o_to_m(&prev_owner, machine, false); // remove machine from prev owner + self.update_o_to_m(owner, machine, true); // insert machine to new owner + + Some((*machine, prev_owner)) } else { // machine is new. Remove this owner's old machine let old_machine = { - let owned_machines = match self.o_to_m.get(owner) { + let owned_machines = match self.o_to_m.get_mut(owner) { Some(x) => x, None => { return None; // no old machines } }; - if owned_machines.contains_key(machine_pop) { - machine_pop // use hint, the machine the owner wants to remove - } else { - // find the oldest machine - match owned_machines.iter().min_by_key(|(_, height)| *height) { - Some((machine, _)) => machine, - None => return None, - } - } - }; + // select the machine to remove. Either the specified, OR the first in the array + let pos = owned_machines + .iter() + .position(|x| x == machine_pop) + .unwrap_or(0); - self.m_to_o.remove(old_machine); // remove old machine - self.m_to_o.insert(*machine, *owner); // insert new machine + let old_machine = owned_machines[pos]; + owned_machines[pos] = *machine; // update the owner machine - (*owner, *old_machine) - }; + old_machine + }; - self.update_o_to_m(&prev_owner, &prev_machine, false, 0_u64); - self.update_o_to_m(owner, machine, true, height); + self.m_to_o.remove(&old_machine); + self.m_to_o.insert(*machine, *owner); + + Some((old_machine, *owner)) + } + } - Some((prev_machine, prev_owner)) + pub fn add_new(&mut self, machine: MachineID) -> bool { + if let std::collections::hash_map::Entry::Vacant(e) = self.m_to_o.entry(machine) { + e.insert([0u8; OWNER_LEN]); + true + } else { + false + } } } } @@ -378,7 +393,7 @@ lazy_static::lazy_static! { }; for x in set { - ret.m_to_o.insert(x, [0_u8; 32]); + ret.add_new(x); } SgxMutex::new(ret) diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index b859217b5a..5abc72aa9c 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -1,6 +1,6 @@ //! use super::attestation::get_quote_ecdsa; -use crate::registration::attestation::{verify_quote_sgx, AttestationCombined}; +use crate::registration::attestation::{allow_list, verify_quote_sgx, AttestationCombined}; #[cfg(feature = "verify-validator-whitelist")] use block_verifier::validator_whitelist; use core::convert::TryInto; @@ -10,7 +10,6 @@ use enclave_crypto::consts::{ FILE_MIGRATION_CERT_REMOTE, FILE_MIGRATION_CONSENSUS, FILE_MIGRATION_DATA, FILE_MIGRATION_TARGET_INFO, FILE_PUBKEY, }; -use enclave_crypto::HASH_SIZE; #[cfg(feature = "random")] use enclave_crypto::{ consts::SELF_REPORT_BODY, AESKey, Ed25519PublicKey, KeyPair, SIVEncryptable, PUBLIC_KEY_SIZE, @@ -695,20 +694,6 @@ pub unsafe extern "C" fn ecall_onchain_approve_upgrade( sgx_types::sgx_status_t::SGX_SUCCESS } -fn calculate_machine_id_evidence(machine_id: &[u8]) -> [u8; HASH_SIZE] { - let mut hasher = Sha256::new(); - - let magic = [b'm', b'i', b'd']; - hasher.update(magic); - - hasher.update(SELF_REPORT_BODY.mr_enclave.m); - hasher.update(machine_id); - - let mut ret = [0_u8; HASH_SIZE]; - ret.copy_from_slice(&hasher.finalize()); - ret -} - struct ProtobufParser<'a> { pub cursor: &'a [u8], } @@ -853,48 +838,106 @@ fn check_machine_id_in_block(_msg_slice: &[u8]) -> bool { pub unsafe extern "C" fn ecall_onchain_approve_machine_id( p_id: *const u8, n_id: u32, - p_proof: *mut u8, - is_on_chain: bool, ) -> sgx_types::sgx_status_t { validate_const_ptr!(p_id, n_id as usize, sgx_status_t::SGX_ERROR_UNEXPECTED); - validate_mut_ptr!(p_proof, 32, sgx_status_t::SGX_ERROR_UNEXPECTED); - if n_id != 20 { + if n_id as usize != allow_list::MACHINE_ID_LEN { println!("machine_id wrong len"); return sgx_types::sgx_status_t::SGX_ERROR_UNEXPECTED; } let machine_id = slice::from_raw_parts(p_id, n_id as usize); - let proof = calculate_machine_id_evidence(machine_id); + let machine_id_str = hex::encode(machine_id); - if is_on_chain { - let machine_id_str = hex::encode(machine_id); + if !check_machine_id_in_block(machine_id_str.as_bytes()) { + error!("machine ID not approved"); + return sgx_types::sgx_status_t::SGX_ERROR_UNEXPECTED; + } - if !check_machine_id_in_block(machine_id_str.as_bytes()) { - error!("machine ID not approved"); - return sgx_types::sgx_status_t::SGX_ERROR_UNEXPECTED; + { + let mut allow_list = crate::registration::attestation::PPID_WHITELIST + .lock() + .unwrap(); + + let machine_id: &allow_list::MachineID = machine_id.try_into().unwrap(); + + if allow_list.add_new(*machine_id) { + println!("Onchain added machine ID: {}", hex::encode(machine_id)); } + } - // TODO: ensure message was in the signed block - slice::from_raw_parts_mut(p_proof, HASH_SIZE).copy_from_slice(&proof); - } else { - // compare - if proof != slice::from_raw_parts(p_proof, HASH_SIZE) { - error!("machine ID not approved earlier"); + sgx_types::sgx_status_t::SGX_SUCCESS +} + +#[no_mangle] +pub unsafe extern "C" fn ecall_submit_machine_swap( + _index: u32, + p_machine_info: *const u8, + n_machine_info: u32, + p_proof: *const u8, + n_proof: u32, +) -> sgx_types::sgx_status_t { + validate_const_ptr!( + p_machine_info, + n_machine_info as usize, + sgx_status_t::SGX_ERROR_UNEXPECTED + ); + validate_const_ptr!( + p_proof, + n_proof as usize, + sgx_status_t::SGX_ERROR_UNEXPECTED + ); + + const MACHINE_SWAP_INFO_LEN: usize = + allow_list::OWNER_LEN + allow_list::MACHINE_ID_LEN + allow_list::MACHINE_ID_LEN; + + let (swap_info_opt, p_machine_id) = match n_machine_info as usize { + MACHINE_SWAP_INFO_LEN => { + let owner: &allow_list::Owner = + slice::from_raw_parts(p_machine_info, allow_list::OWNER_LEN) + .try_into() + .unwrap(); + + let machine_id_pop: &allow_list::MachineID = slice::from_raw_parts( + p_machine_info.add(allow_list::OWNER_LEN + allow_list::MACHINE_ID_LEN), + allow_list::MACHINE_ID_LEN, + ) + .try_into() + .unwrap(); + + ( + Some((owner, machine_id_pop)), + p_machine_info.add(allow_list::OWNER_LEN), + ) + } + allow_list::MACHINE_ID_LEN => (None, p_machine_info), + _ => { + println!("machine_info wrong len"); return sgx_types::sgx_status_t::SGX_ERROR_UNEXPECTED; } - } + }; + + let machine_id: &allow_list::MachineID = + slice::from_raw_parts(p_machine_id, allow_list::MACHINE_ID_LEN) + .try_into() + .unwrap(); { let mut allow_list = crate::registration::attestation::PPID_WHITELIST .lock() .unwrap(); - let arg: &[u8; 20] = machine_id.try_into().unwrap(); - - if !allow_list.m_to_o.contains_key(arg) { - println!("Onchain added machine ID: {}", hex::encode(arg)); - allow_list.m_to_o.insert(*arg, [0_u8; 32]); + if let Some(swap_info) = swap_info_opt { + if allow_list + .update(machine_id, swap_info.0, swap_info.1) + .is_some() + { + println!("cold updated machine ID: {}", hex::encode(machine_id)); + } + } else { + if allow_list.add_new(*machine_id) { + println!("cold added machine ID: {}", hex::encode(machine_id)); + } } } diff --git a/cosmwasm/enclaves/execute/src/registration/onchain.rs b/cosmwasm/enclaves/execute/src/registration/onchain.rs index 0181150447..43c21a1130 100644 --- a/cosmwasm/enclaves/execute/src/registration/onchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/onchain.rs @@ -116,7 +116,7 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( return NodeAuthResult::MemorySafetyAllocationError; } - let machine_data = allow_list::OWNER_LEN + allow_list::MACHINE_ID_LEN; + const MACHINE_INFO_LEN: usize = allow_list::OWNER_LEN + allow_list::MACHINE_ID_LEN; validate_mut_ptr!(p_seeds, n_seeds as usize, NodeAuthResult::InvalidInput); validate_const_ptr!( @@ -126,7 +126,7 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( ); validate_mut_ptr!( p_machine_del_add, - machine_data * 2, + MACHINE_INFO_LEN * 2, NodeAuthResult::InvalidInput ); validate_const_ptr!(cert, cert_len as usize, NodeAuthResult::InvalidInput); @@ -202,17 +202,11 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( .try_into() .unwrap(); - let height = { - let extra = KEY_MANAGER.extra_data.lock().unwrap(); - extra.height - }; - // if swap-res failed - never mind. This is probably because the machine was added with proof-of-cloud - if let Some(swap_res) = - allow_list.update(&machine_id_hash, owner, machine_pop, height) + if let Some(swap_res) = allow_list.update(&machine_id_hash, owner, machine_pop) { copy_machine_data_res( - p_machine_del_add.add(machine_data), + p_machine_del_add.add(MACHINE_INFO_LEN), &machine_id_hash, owner, ); diff --git a/cosmwasm/packages/sgx-vm/src/attestation.rs b/cosmwasm/packages/sgx-vm/src/attestation.rs index 845135488b..a30b5c17d5 100644 --- a/cosmwasm/packages/sgx-vm/src/attestation.rs +++ b/cosmwasm/packages/sgx-vm/src/attestation.rs @@ -73,7 +73,7 @@ pub fn untrusted_get_encrypted_seed( seed_buffer.resize(SINGLE_ENCRYPTED_SEED_SIZE * 100, 0); // should be enough. Resize in later version, when approaching the limit let mut seeds_size: u32 = 0; - let mut machine_pop = [0_u8; 20]; + let machine_pop = [0_u8; 20]; // TODO - pass hint let mut machine_add_del = [0_u8; 104]; let status = unsafe { diff --git a/cosmwasm/packages/sgx-vm/src/lib.rs b/cosmwasm/packages/sgx-vm/src/lib.rs index 3971c8ad2f..322f214a5d 100644 --- a/cosmwasm/packages/sgx-vm/src/lib.rs +++ b/cosmwasm/packages/sgx-vm/src/lib.rs @@ -56,7 +56,8 @@ pub use crate::attestation::{ pub use crate::seed::{ untrusted_approve_machine_id, untrusted_approve_upgrade, untrusted_get_network_pubkey, untrusted_health_check, untrusted_init_bootstrap, untrusted_init_node, untrusted_key_gen, - untrusted_migration_op, untrusted_rotate_store, untrusted_submit_validator_set_evidence, + untrusted_migration_op, untrusted_rotate_store, untrusted_submit_machine_swap, + untrusted_submit_validator_set_evidence, }; pub use crate::random::untrusted_submit_block_signatures; diff --git a/cosmwasm/packages/sgx-vm/src/seed.rs b/cosmwasm/packages/sgx-vm/src/seed.rs index dfa2fe3608..bd1777c115 100644 --- a/cosmwasm/packages/sgx-vm/src/seed.rs +++ b/cosmwasm/packages/sgx-vm/src/seed.rs @@ -61,8 +61,16 @@ extern "C" { retval: *mut sgx_status_t, p_id: *const u8, n_id: u32, - p_proof: *mut u8, - is_on_chain: bool, + ) -> sgx_types::sgx_status_t; + + pub fn ecall_submit_machine_swap( + eid: sgx_enclave_id_t, + retval: *mut sgx_status_t, + index: u32, + p_machine_info: *const u8, + n_machine_info: u32, + p_proof: *const u8, + n_proof: u32, ) -> sgx_types::sgx_status_t; /// Trigger a query method in a wasm contract @@ -273,11 +281,7 @@ pub fn untrusted_approve_upgrade(msg_slice: &[u8]) -> SgxResult<()> { Ok(()) } -pub fn untrusted_approve_machine_id( - machine_id: &[u8], - proof: *mut u8, - is_on_chain: bool, -) -> SgxResult<()> { +pub fn untrusted_approve_machine_id(machine_id: &[u8]) -> SgxResult<()> { // Bind the token to a local variable to ensure its // destructor runs in the end of the function let enclave_access_token = ENCLAVE_DOORBELL @@ -295,8 +299,43 @@ pub fn untrusted_approve_machine_id( &mut ret, machine_id.as_ptr(), machine_id.len() as u32, - proof, - is_on_chain, + ) + }; + + if status != sgx_status_t::SGX_SUCCESS { + return Err(status); + } + + if ret != sgx_status_t::SGX_SUCCESS { + return Err(ret); + } + + Ok(()) +} + +pub fn untrusted_submit_machine_swap( + index: u32, + machine_info: &[u8], + proof: &[u8], +) -> SgxResult<()> { + let enclave_access_token = ENCLAVE_DOORBELL + .get_access(1) // This can never be recursive + .ok_or(sgx_status_t::SGX_ERROR_BUSY)?; + let enclave = (*enclave_access_token)?; + + //info!("Initialized enclave successfully!"); + + let eid = enclave.geteid(); + let mut ret = sgx_status_t::SGX_SUCCESS; + let status = unsafe { + ecall_submit_machine_swap( + eid, + &mut ret, + index, + machine_info.as_ptr(), + machine_info.len() as u32, + proof.as_ptr(), + proof.len() as u32, ) }; diff --git a/go-cosmwasm/api/bindings.h b/go-cosmwasm/api/bindings.h index f9260f072a..47ff68a4d1 100644 --- a/go-cosmwasm/api/bindings.h +++ b/go-cosmwasm/api/bindings.h @@ -222,7 +222,7 @@ Buffer migrate(cache_t *cache, bool migration_op(uint32_t opcode); -bool onchain_approve_machine_id(Buffer machine_id, uint8_t *proof, bool is_on_chain); +bool onchain_approve_machine_id(Buffer machine_id); bool onchain_approve_upgrade(Buffer msg); @@ -255,6 +255,8 @@ TwoBuffers submit_block_signatures(Buffer header, Buffer random, Buffer *err); +bool submit_machine_swap(uint32_t index, Buffer machine_info, Buffer proof); + void submit_validator_set_evidence(Buffer evidence, Buffer *err); Buffer update_admin(cache_t *cache, diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index 4f86807029..d1653d513b 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -196,11 +196,11 @@ func OnUpgradeProposalPassed(mrEnclaveHash []byte) error { return nil } -func OnApproveMachineID(machineID []byte, proof *[32]byte, is_on_chain bool) error { +func OnApproveMachineID(machineID []byte) error { msgBuf := sendSlice(machineID) defer freeAfterSend(msgBuf) - ret, err := C.onchain_approve_machine_id(msgBuf, (*C.uint8_t)(unsafe.Pointer(proof)), C.bool(is_on_chain)) + ret, err := C.onchain_approve_machine_id(msgBuf) if err != nil { return err } @@ -211,6 +211,23 @@ func OnApproveMachineID(machineID []byte, proof *[32]byte, is_on_chain bool) err return nil } +func SubmitMachineSwap(index uint32, machineInfo []byte, proof []byte) error { + machineInfoBuf := sendSlice(machineInfo) + defer freeAfterSend(machineInfoBuf) + proofBuf := sendSlice(proof) + defer freeAfterSend(proofBuf) + + ret, err := C.submit_machine_swap(u32(index), machineInfoBuf, proofBuf) + if err != nil { + return err + } + if !ret { + return errors.New("submit_machine_swap failed") + } + + return nil +} + func Create(cache Cache, wasm []byte) ([]byte, error) { code := sendSlice(wasm) defer freeAfterSend(code) diff --git a/go-cosmwasm/api/lib_mock.go b/go-cosmwasm/api/lib_mock.go index 05084b8fc8..fc9036d661 100644 --- a/go-cosmwasm/api/lib_mock.go +++ b/go-cosmwasm/api/lib_mock.go @@ -316,6 +316,10 @@ func OnUpgradeProposalPassed(mrEnclaveHash []byte) error { return nil } -func OnApproveMachineID(machineID []byte, proof *[32]byte, is_on_chain bool) error { +func OnApproveMachineID(machineID []byte) error { + return nil +} + +func SubmitMachineSwap(index uint32, machineInfo []byte, proof []byte) error { return nil } diff --git a/go-cosmwasm/src/lib.rs b/go-cosmwasm/src/lib.rs index 1fc077c0bd..7fbebaac1d 100644 --- a/go-cosmwasm/src/lib.rs +++ b/go-cosmwasm/src/lib.rs @@ -16,7 +16,8 @@ use cosmwasm_sgx_vm::{ untrusted_approve_upgrade, untrusted_get_encrypted_genesis_seed, untrusted_get_encrypted_seed, untrusted_get_network_pubkey, untrusted_health_check, untrusted_init_bootstrap, untrusted_init_node, untrusted_key_gen, untrusted_migration_op, untrusted_rotate_store, - untrusted_submit_validator_set_evidence, Checksum, CosmCache, Extern, + untrusted_submit_machine_swap, untrusted_submit_validator_set_evidence, Checksum, CosmCache, + Extern, }; use ctor::ctor; pub use db::{db_t, DB}; @@ -979,11 +980,7 @@ pub extern "C" fn onchain_approve_upgrade(msg: Buffer) -> bool { #[no_mangle] #[allow(deprecated)] -pub extern "C" fn onchain_approve_machine_id( - machine_id: Buffer, - proof: *mut u8, - is_on_chain: bool, -) -> bool { +pub extern "C" fn onchain_approve_machine_id(machine_id: Buffer) -> bool { let machine_id_slice = match unsafe { machine_id.read() } { None => { return false; @@ -991,7 +988,36 @@ pub extern "C" fn onchain_approve_machine_id( Some(r) => r, }; - match untrusted_approve_machine_id(&machine_id_slice, proof, is_on_chain) { + match untrusted_approve_machine_id(machine_id_slice) { + Err(e) => { + set_error(Error::enclave_err(e.to_string()), None); + false + } + Ok(()) => { + clear_error(); + true + } + } +} + +#[no_mangle] +#[allow(deprecated)] +pub extern "C" fn submit_machine_swap(index: u32, machine_info: Buffer, proof: Buffer) -> bool { + let machine_info_slice = match unsafe { machine_info.read() } { + None => { + return false; + } + Some(r) => r, + }; + + let proof_slice = match unsafe { proof.read() } { + None => { + return false; + } + Some(r) => r, + }; + + match untrusted_submit_machine_swap(index, machine_info_slice, proof_slice) { Err(e) => { set_error(Error::enclave_err(e.to_string()), None); false diff --git a/x/compute/internal/keeper/keeper.go b/x/compute/internal/keeper/keeper.go index a7dbb8fae1..d57a09918d 100644 --- a/x/compute/internal/keeper/keeper.go +++ b/x/compute/internal/keeper/keeper.go @@ -323,33 +323,6 @@ func (k Keeper) SetEnclaveColdEvidences(ctx sdk.Context) error { _ = api.SubmitValidatorSetEvidence(validator_set_evidence) } - // on-chain approved machines - - prefixKey := types.MachineIDEvidencePrefix - - iterator, _ := store.Iterator(prefixKey, nil) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - key := iterator.Key() - if !bytes.HasPrefix(key, prefixKey) { - break - } - value := iterator.Value() - - if len(value) == 32 { - var proof [32]byte - copy(proof[:], value) - - id := key[len(prefixKey):] - - err := api.OnApproveMachineID(id, &proof, false) - if err != nil { - fmt.Println("Couldn't approve machine-id ", id) - } - } - } - return nil } diff --git a/x/compute/internal/keeper/msg_server.go b/x/compute/internal/keeper/msg_server.go index e6d5355cf2..9a62c9f2c5 100644 --- a/x/compute/internal/keeper/msg_server.go +++ b/x/compute/internal/keeper/msg_server.go @@ -373,23 +373,19 @@ func (m msgServer) UpdateMachineWhitelist(goCtx context.Context, msg *types.MsgU sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), )) - store := m.keeper.storeService.OpenKVStore(ctx) - ids, err := ParseHexList(msg.MachineId) if err != nil { return nil, err } for _, id := range ids { - proof := [32]byte{} - err := api.OnApproveMachineID(id, &proof, true) + err := api.OnApproveMachineID(id) id_txt := hex.EncodeToString(id) if err != nil { fmt.Println("Failed to add machine_id: ", id_txt) } else { fmt.Println("Added machine_id: ", id_txt) - key := append(types.MachineIDEvidencePrefix, id...) - _ = store.Set(key, proof[:]) + _ = m.keeper.regKeeper.OnNewMachine(ctx, id) } } diff --git a/x/registration/internal/keeper/keeper.go b/x/registration/internal/keeper/keeper.go index d8a5fcaed8..dee16ba8b1 100644 --- a/x/registration/internal/keeper/keeper.go +++ b/x/registration/internal/keeper/keeper.go @@ -8,9 +8,12 @@ import ( "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/store/prefix" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/scrtlabs/SecretNetwork/go-cosmwasm/api" "github.com/scrtlabs/SecretNetwork/x/registration/internal/types" ra "github.com/scrtlabs/SecretNetwork/x/registration/remote_attestation" ) @@ -124,6 +127,57 @@ func InitializeNode(homeDir string, enclave EnclaveInterface) { } } +func (k Keeper) AddMachineSwapInfo(ctx sdk.Context, data []byte) error { + store := k.storeService.OpenKVStore(ctx) + + var next_index [4]byte + + { + bz, _ := store.Get(types.RegistrationMachineIndex) + if bz != nil { + next_index_numeric := binary.BigEndian.Uint32(bz) + 1 + binary.BigEndian.PutUint32(next_index[:], next_index_numeric) + + } + } + + store.Set(types.RegistrationMachineIndex, next_index[:]) + + key := make([]byte, 0, len(types.RegistrationMachinePrefix)+4) + key = append(key, types.RegistrationMachinePrefix...) + key = append(key, next_index[:]...) + + store.Set(key, data) + + return nil +} + +func (k Keeper) OnNewMachine(ctx sdk.Context, id []byte) error { + return k.AddMachineSwapInfo(ctx, id) +} + +func (k Keeper) SetEnclaveColdData(ctx sdk.Context) error { + // on-chain approved machine migrations + + store := k.storeService.OpenKVStore(ctx) + prefixStore := prefix.NewStore(runtime.KVStoreAdapter(store), types.RegistrationMachinePrefix) + it := prefixStore.Iterator(nil, nil) + defer it.Close() + + for ; it.Valid(); it.Next() { + key := it.Key() + index := binary.BigEndian.Uint32(key[len(types.RegistrationMachinePrefix):]) + value := it.Value() + + // TODO: proof + var proof []byte + + api.SubmitMachineSwap(index, value, proof) + } + + return nil +} + func (k Keeper) RegisterNode(ctx sdk.Context, certificate ra.Certificate) ([]byte, error) { // fmt.Println("RegisterNode") var encSeed []byte @@ -141,19 +195,25 @@ func (k Keeper) RegisterNode(ctx sdk.Context, certificate ra.Certificate) ([]byt publicKey = publicKey_ - isAuth, err := k.isNodeAuthenticated(ctx, publicKey) - if err != nil { - return nil, errorsmod.Wrap(types.ErrAuthenticateFailed, err.Error()) - } - if isAuth { - return k.getRegistrationInfo(ctx, publicKey).EncryptedSeed, nil - } + // Note: don't skip envoking the enclave even if the node was already registered. + // The enclave may realize the new node ownership - encSeed, _, err = k.enclave.GetEncryptedSeed(certificate) + var machineSwapInfo []byte + encSeed, machineSwapInfo, err = k.enclave.GetEncryptedSeed(certificate) if err != nil { // return 0, errorsmod.Wrap(err, "cosmwasm create") return nil, errorsmod.Wrap(types.ErrAuthenticateFailed, err.Error()) } + + if len(machineSwapInfo) == 104 { + + store_swap_info := make([]byte, 72) + copy(store_swap_info[:52], machineSwapInfo[52:52+52]) + + // last 20 bytes are the machine_id_pop - will be added later + k.AddMachineSwapInfo(ctx, store_swap_info) + } + } regInfo := types.RegistrationNodeInfo{ diff --git a/x/registration/internal/types/keys.go b/x/registration/internal/types/keys.go index 0095715781..0700c80ee3 100644 --- a/x/registration/internal/types/keys.go +++ b/x/registration/internal/types/keys.go @@ -20,6 +20,8 @@ const ( var ( RegistrationStorePrefix = []byte{0x01} RegistrationMasterKeyPrefix = []byte{0x02} + RegistrationMachinePrefix = []byte{0x03} + RegistrationMachineIndex = []byte{0x04} ) func RegistrationKeyPrefix(key []byte) []byte { From 21327f2299236596a28f69a94a1b93547d44dc60 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 6 Apr 2026 08:57:44 +0000 Subject: [PATCH 10/55] enclave: saving the last apphash --- .../src/submit_block_signatures.rs | 11 +++++++++++ .../enclaves/shared/utils/src/key_manager.rs | 18 +++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs index c0dec456e0..f3b401a5c0 100644 --- a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs +++ b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs @@ -133,6 +133,17 @@ pub unsafe fn submit_block_signatures_impl( .copy_from_slice(validator_set_evidence.as_slice()); } + let apphash = header.header().app_hash.as_bytes(); + if apphash.len() == 32 { + println!("saving apphash: {}", hex::encode(apphash)); + + { + let mut extra = KEY_MANAGER.extra_data.lock().unwrap(); + extra.apphash.copy_from_slice(apphash); + } + KEY_MANAGER.save(); + } + debug!( "Done verifying block height: {:?}", header.header.height.value() diff --git a/cosmwasm/enclaves/shared/utils/src/key_manager.rs b/cosmwasm/enclaves/shared/utils/src/key_manager.rs index b9a64aa535..0216690277 100644 --- a/cosmwasm/enclaves/shared/utils/src/key_manager.rs +++ b/cosmwasm/enclaves/shared/utils/src/key_manager.rs @@ -39,6 +39,7 @@ use tendermint_proto::Protobuf; // as sha256(key) encrypted with the seed. pub struct KeychainMutableData { pub height: u64, + pub apphash: [u8; 32], pub validator_set_serialized: Vec, pub next_mr_enclave: Option, pub last_block_seed: u16, @@ -128,6 +129,10 @@ impl Keychain { 2_u8 } else { 0_u8 + }) | (if extra.apphash != [0u8; 32] { + 4_u8 + } else { + 0_u8 }); writer.write_all(&[ex_flag])?; @@ -140,6 +145,10 @@ impl Keychain { writer.write_all(&extra.last_block_seed.to_le_bytes())?; } + if ex_flag & 4_u8 != 0 { + writer.write_all(&extra.apphash)?; + } + Ok(()) } @@ -149,7 +158,7 @@ impl Keychain { Ok(u16::from_le_bytes(buf)) } - fn read_u32(reader: &mut dyn Read) -> std::io::Result { + pub fn read_u32(reader: &mut dyn Read) -> std::io::Result { let mut buf = [0u8; 4]; reader.read_exact(&mut buf)?; Ok(u32::from_le_bytes(buf)) @@ -220,6 +229,12 @@ impl Keychain { extra.last_block_seed = DEF_LAST_BLOCK_SEED; } + if (flag_bytes[0] & 4_u8) != 0 { + reader.read_exact(&mut extra.apphash)?; + } else { + extra.apphash = [0u8; 32]; + } + Ok(()) } @@ -283,6 +298,7 @@ impl Keychain { random_encryption_key: None, extra_data: SgxMutex::new(KeychainMutableData { height: 0, + apphash: [0u8; 32], validator_set_serialized: Vec::new(), next_mr_enclave: None, last_block_seed: DEF_LAST_BLOCK_SEED, From d8d9932f9b8833359244c6a5c7ca455ee757e5d4 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 6 Apr 2026 09:11:01 +0000 Subject: [PATCH 11/55] passing regKeeper by pointer --- app/keepers/keepers.go | 4 ++-- x/compute/internal/keeper/keeper.go | 4 ++-- x/compute/internal/keeper/test_common.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 3dc958096f..0b6102f067 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -383,7 +383,7 @@ func (ak *SecretAppKeepers) InitCustomKeepers( bootstrap, ) ak.RegKeeper = ®Keeper - ak.CronKeeper.SetRegKeeper(regKeeper) + ak.CronKeeper.SetRegKeeper(®Keeper) // Assaf: // Rules: @@ -539,7 +539,7 @@ func (ak *SecretAppKeepers) InitCustomKeepers( ak.TransferKeeper, ak.IbcKeeper.ChannelKeeper, ak.IbcSwitchKeeper, - *ak.RegKeeper, + ak.RegKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), computeDir, diff --git a/x/compute/internal/keeper/keeper.go b/x/compute/internal/keeper/keeper.go index d57a09918d..011b429274 100644 --- a/x/compute/internal/keeper/keeper.go +++ b/x/compute/internal/keeper/keeper.go @@ -85,7 +85,7 @@ type Keeper struct { bankKeeper bankkeeper.Keeper portKeeper portkeeper.Keeper capabilityKeeper capabilitykeeper.ScopedKeeper - regKeeper registration.Keeper + regKeeper *registration.Keeper cronKeeper cronkeeper.Keeper wasmer wasm.Wasmer queryPlugins QueryPlugins @@ -125,7 +125,7 @@ func NewKeeper( portSource types.ICS20TransferPortSource, channelKeeper channelkeeper.Keeper, ics4Wrapper porttypes.ICS4Wrapper, - regKeeper registration.Keeper, + regKeeper *registration.Keeper, msgRouter MessageRouter, queryRouter GRPCQueryRouter, homeDir string, diff --git a/x/compute/internal/keeper/test_common.go b/x/compute/internal/keeper/test_common.go index 6e3650fd8d..371f25fc65 100644 --- a/x/compute/internal/keeper/test_common.go +++ b/x/compute/internal/keeper/test_common.go @@ -609,7 +609,7 @@ func CreateTestInput(t *testing.T, isCheckTx bool, supportedFeatures string, enc MockIBCTransferKeeper{}, ibcKeeper.ChannelKeeper, nil, - regKeeper, + ®Keeper, msgRouter, queryRouter, tempDir, From f498058a1bcd1279ef551ecdc2840c90154e2c9f Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 6 Apr 2026 09:11:40 +0000 Subject: [PATCH 12/55] enclave: Merkle proof verification vs last apphash --- .../execute/src/registration/offchain.rs | 140 +++++++++++++++++- 1 file changed, 139 insertions(+), 1 deletion(-) diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index 5abc72aa9c..fedfe89f4d 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -32,6 +32,7 @@ use sgx_types::{ use sha2::{Digest, Sha256}; use std::collections::HashMap; use std::fs::File; +use std::io; use std::io::prelude::*; use std::panic; use std::sgxfs::SgxFile; @@ -869,9 +870,91 @@ pub unsafe extern "C" fn ecall_onchain_approve_machine_id( sgx_types::sgx_status_t::SGX_SUCCESS } +struct MerkleProcessor<'a> { + cursor: io::Cursor<&'a [u8]>, +} + +impl<'a> MerkleProcessor<'a> { + fn new(data: &'a [u8]) -> Self { + Self { + cursor: io::Cursor::new(data), + } + } + + fn read_slice_n(&mut self, n: usize) -> io::Result<&'a [u8]> { + let pos = self.cursor.position() as usize; + let buf = self.cursor.get_ref(); + + if pos + n > buf.len() { + return Err(io::Error::new( + io::ErrorKind::UnexpectedEof, + "not enough bytes", + )); + } + + let out = &buf[pos..pos + n]; + self.cursor.set_position((pos + n) as u64); + Ok(out) + } + + fn read_slice(&mut self) -> io::Result<&'a [u8]> { + let n = Keychain::read_u32(&mut self.cursor)? as usize; + self.read_slice_n(n) + } + + fn hash_var_uint(hasher: &mut Sha256, mut x: usize) { + loop { + if x < 0x80 { + let b = x as u8; + hasher.update([b]); + break; + } + + let b = 0x80 | ((x & 0x7f) as u8); + hasher.update([b]); + x >>= 7; + } + } + + fn hash_leaf_iavl(&mut self, key: &[u8], val: &[u8]) -> io::Result<[u8; 32]> { + let prefix = self.read_slice()?; + + let valhash: [u8; 32] = { + let mut hasher = Sha256::new(); + hasher.update(val); + hasher.finalize().into() + }; + + let mut hasher = Sha256::new(); + hasher.update(prefix); // prefix len isn't required + Self::hash_var_uint(&mut hasher, key.len()); + hasher.update(key); + Self::hash_var_uint(&mut hasher, valhash.len()); + hasher.update(&valhash); + + Ok(hasher.finalize().into()) + } + + fn interpret_sub_path(&mut self, hash_value: &mut [u8; 32]) -> io::Result<()> { + //println!("*** leaf hash: {}", hex::encode(&hash_value)); + + let n = Keychain::read_u32(&mut self.cursor)?; + for _i in 0..n { + let mut hasher = Sha256::new(); + hasher.update(self.read_slice()?); // prefix + hasher.update(&hash_value); + hasher.update(self.read_slice()?); // suffix + *hash_value = hasher.finalize().into(); + //println!("*** next hash: {}", hex::encode(&hash_value)); + } + + Ok(()) + } +} + #[no_mangle] pub unsafe extern "C" fn ecall_submit_machine_swap( - _index: u32, + index: u32, p_machine_info: *const u8, n_machine_info: u32, p_proof: *const u8, @@ -888,6 +971,61 @@ pub unsafe extern "C" fn ecall_submit_machine_swap( sgx_status_t::SGX_ERROR_UNEXPECTED ); + let merkle_proof_result = (|| -> io::Result<()> { + // verify merkle proof + + let apphash = { + let extra = KEY_MANAGER.extra_data.lock().unwrap(); + extra.apphash + }; + + //println!("expected apphash: {}", hex::encode(&apphash)); + + let mut merkle = MerkleProcessor::new(slice::from_raw_parts(p_proof, n_proof as usize)); + + let proof_parts = Keychain::read_u32(&mut merkle.cursor)?; + if proof_parts != 2 { + return Err(io::Error::new( + io::ErrorKind::InvalidData, + "proof wrong len", + )); + } + + // leaf + let mut hash_val = { + let mut k = [0u8; 5]; + k[0] = 0x03; // RegistrationMachinePrefix + k[1..5].copy_from_slice(&index.to_le_bytes()); + + let v = slice::from_raw_parts(p_machine_info, n_machine_info as usize); + + merkle.hash_leaf_iavl(&k, v)? + }; + + merkle.interpret_sub_path(&mut hash_val)?; + + hash_val = { + let k = b"register"; + merkle.hash_leaf_iavl(k, &hash_val)? + }; + + merkle.interpret_sub_path(&mut hash_val)?; + + if apphash != hash_val { + return Err(io::Error::new( + io::ErrorKind::InvalidData, + "apphash mismatch", + )); + } + + Ok(()) + })(); + + if let Err(e) = merkle_proof_result { + println!("Merkle proof failed: {}", e); + return sgx_types::sgx_status_t::SGX_ERROR_UNEXPECTED; + } + const MACHINE_SWAP_INFO_LEN: usize = allow_list::OWNER_LEN + allow_list::MACHINE_ID_LEN + allow_list::MACHINE_ID_LEN; From 80feb7ad5f6d76e38d68aacab71c6e34c1518c57 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 6 Apr 2026 09:13:56 +0000 Subject: [PATCH 13/55] regKeeper: passing Merkle proof to enclave --- app/app.go | 1 - app/keepers/keepers.go | 1 + x/compute/internal/keeper/keeper.go | 2 + x/compute/internal/keeper/test_common.go | 1 + x/registration/internal/keeper/keeper.go | 164 +++++++++++++++++- x/registration/internal/keeper/test_common.go | 2 +- 6 files changed, 163 insertions(+), 8 deletions(-) diff --git a/app/app.go b/app/app.go index ee8cf7c9b3..d2ff3a58fa 100644 --- a/app/app.go +++ b/app/app.go @@ -511,7 +511,6 @@ func (app *SecretNetworkApp) Initialize() { ctx := sdk.NewContext(ms, cmtproto.Header{}, false, app.Logger()) _ = app.AppKeepers.ComputeKeeper.SetEnclaveColdEvidences(ctx) - _ = app.AppKeepers.RegKeeper.SetEnclaveColdData(ctx) app.UpdateNetworkKeys() } diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 0b6102f067..692ffdd86e 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -381,6 +381,7 @@ func (ak *SecretAppKeepers) InitCustomKeepers( reg.EnclaveApi{}, homePath, bootstrap, + app, ) ak.RegKeeper = ®Keeper ak.CronKeeper.SetRegKeeper(®Keeper) diff --git a/x/compute/internal/keeper/keeper.go b/x/compute/internal/keeper/keeper.go index 011b429274..c755d5aeec 100644 --- a/x/compute/internal/keeper/keeper.go +++ b/x/compute/internal/keeper/keeper.go @@ -1122,6 +1122,8 @@ func (k Keeper) SetRandomSeed(ctx sdk.Context, random []byte, validator_set_evid if err != nil { ctx.Logger().Error("SetRandomSeed:", err.Error()) } + + k.regKeeper.MaybeSetEnclaveColdData(ctx) } func (k Keeper) GetContractAddress(ctx sdk.Context, label string) sdk.AccAddress { diff --git a/x/compute/internal/keeper/test_common.go b/x/compute/internal/keeper/test_common.go index 371f25fc65..139c00d827 100644 --- a/x/compute/internal/keeper/test_common.go +++ b/x/compute/internal/keeper/test_common.go @@ -588,6 +588,7 @@ func CreateTestInput(t *testing.T, isCheckTx bool, supportedFeatures string, enc registration.EnclaveApi{}, tempDir, false, + &baseapp.BaseApp{}, ) bappTxMngr := baseapp.LastMsgMarkerContainer{} diff --git a/x/registration/internal/keeper/keeper.go b/x/registration/internal/keeper/keeper.go index dee16ba8b1..b39036083c 100644 --- a/x/registration/internal/keeper/keeper.go +++ b/x/registration/internal/keeper/keeper.go @@ -1,18 +1,25 @@ package keeper import ( + "bytes" + "context" "encoding/binary" "encoding/hex" "encoding/json" + "fmt" "path/filepath" "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/store/prefix" + abci "github.com/cometbft/cometbft/abci/types" + cmtcrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/gogoproto/proto" + ics23 "github.com/cosmos/ics23/go" "github.com/scrtlabs/SecretNetwork/go-cosmwasm/api" "github.com/scrtlabs/SecretNetwork/x/registration/internal/types" ra "github.com/scrtlabs/SecretNetwork/x/registration/remote_attestation" @@ -24,10 +31,12 @@ type Keeper struct { cdc codec.Codec enclave EnclaveInterface router baseapp.MessageRouter + queryer ABCIQueryer + coldDataSet bool } // NewKeeper creates a new contract Keeper instance -func NewKeeper(cdc codec.Codec, storeService store.KVStoreService, router baseapp.MessageRouter, enclave EnclaveInterface, homeDir string, bootstrap bool) Keeper { +func NewKeeper(cdc codec.Codec, storeService store.KVStoreService, router baseapp.MessageRouter, enclave EnclaveInterface, homeDir string, bootstrap bool, q ABCIQueryer) Keeper { if !bootstrap { InitializeNode(homeDir, enclave) } @@ -37,6 +46,8 @@ func NewKeeper(cdc codec.Codec, storeService store.KVStoreService, router baseap cdc: cdc, router: router, enclave: enclave, + queryer: q, + coldDataSet: false, } } @@ -156,7 +167,117 @@ func (k Keeper) OnNewMachine(ctx sdk.Context, id []byte) error { return k.AddMachineSwapInfo(ctx, id) } -func (k Keeper) SetEnclaveColdData(ctx sdk.Context) error { +type ABCIQueryer interface { + Query(ctx context.Context, req *abci.RequestQuery) (*abci.ResponseQuery, error) +} + +// // Simple protobuf uvarint (VAR_PROTO) encoder +// func encodeUVarint(x uint64) []byte { +// buf := make([]byte, binary.MaxVarintLen64) +// n := binary.PutUvarint(buf, x) +// return buf[:n] +// } + +// func LeafHashIAVL(prefix, key, value []byte) []byte { +// // Prehash key: NO_HASH +// k := key + +// // Prehash value: SHA256 +// vHash := sha256.Sum256(value) +// v := vHash[:] + +// // Length encoding: VAR_PROTO (protobuf uvarint) +// // (for <128, it becomes one byte) +// kLen := encodeUVarint(uint64(len(k))) +// vLen := encodeUVarint(uint64(len(v))) + +// // Build leaf bytes +// leafBytes := make([]byte, 0, len(prefix)+len(kLen)+len(k)+len(vLen)+len(v)) +// leafBytes = append(leafBytes, prefix...) +// leafBytes = append(leafBytes, kLen...) +// leafBytes = append(leafBytes, k...) +// leafBytes = append(leafBytes, vLen...) +// leafBytes = append(leafBytes, v...) + +// // Final leaf hash = SHA256(leafBytes) +// h := sha256.Sum256(leafBytes) +// return h[:] +// } + +func SerializeMerkleProof(ops []cmtcrypto.ProofOp) (error, []byte) { + proof_serialized := new(bytes.Buffer) + + _ = binary.Write(proof_serialized, binary.LittleEndian, uint32(len(ops))) + + // var hash []byte + + for _, op := range ops { + // fmt.Printf("Op #%d:\n", i) + // fmt.Printf(" Type: %s\n", op.Type) + // fmt.Printf(" Key: %s\n", hex.EncodeToString(op.Key)) + + var cp ics23.CommitmentProof + if err := proto.Unmarshal(op.Data, &cp); err != nil { + return fmt.Errorf("failed to unmarshal ICS23 proof: %w", err), nil + } + + switch p := cp.Proof.(type) { + + case *ics23.CommitmentProof_Exist: + ep := p.Exist + // fmt.Printf("ExistenceProof:\n") + // fmt.Printf(" Key: %s\n", hex.EncodeToString(ep.Key)) + // fmt.Printf(" Value: %s\n", hex.EncodeToString(ep.Value)) + + lo := ep.Leaf + // fmt.Printf("LeafOp:\n") + // fmt.Printf(" hash = %v\n", lo.Hash) + // fmt.Printf(" prehash_key = %v\n", lo.PrehashKey) + // fmt.Printf(" prehash_val = %v\n", lo.PrehashValue) + // fmt.Printf(" length = %v\n", lo.Length) + // fmt.Printf(" prefix = %X\n", lo.Prefix) + + // hash = LeafHashIAVL(lo.Prefix, ep.Key, ep.Value) + // fmt.Println("Leaf hash: ", hex.EncodeToString(hash)) + + _ = binary.Write(proof_serialized, binary.LittleEndian, uint32(len(lo.Prefix))) + proof_serialized.Write(lo.Prefix) + + _ = binary.Write(proof_serialized, binary.LittleEndian, uint32(len(ep.Path))) + + for _, innerOp := range ep.Path { + // fmt.Printf(" Prefix: %s\n", hex.EncodeToString(innerOp.Prefix)) + // fmt.Printf(" Suffix: %s\n", hex.EncodeToString(innerOp.Suffix)) + // fmt.Printf(" HashOp: %d\n", innerOp.Hash) + + // hash_inp := append(innerOp.Prefix, hash...) + // hash_inp = append(hash_inp, innerOp.Suffix...) + // h := sha256.Sum256(hash_inp) + // hash = h[:] + + _ = binary.Write(proof_serialized, binary.LittleEndian, uint32(len(innerOp.Prefix))) + proof_serialized.Write(innerOp.Prefix) + _ = binary.Write(proof_serialized, binary.LittleEndian, uint32(len(innerOp.Suffix))) + proof_serialized.Write(innerOp.Suffix) + + // fmt.Printf(" value: %s\n", hex.EncodeToString(hash)) + } + + default: + return fmt.Errorf("unknown ICS23 proof type in CommitmentProof: %w", p), nil + } + } + + return nil, proof_serialized.Bytes() +} + +func (k *Keeper) MaybeSetEnclaveColdData(ctx sdk.Context) error { + if k.coldDataSet { + return nil + } + + k.coldDataSet = true + // on-chain approved machine migrations store := k.storeService.OpenKVStore(ctx) @@ -164,15 +285,46 @@ func (k Keeper) SetEnclaveColdData(ctx sdk.Context) error { it := prefixStore.Iterator(nil, nil) defer it.Close() + // apphash := ctx.BlockHeader().AppHash + // fmt.Println("**** AppHash: ", hex.EncodeToString(apphash)) + for ; it.Valid(); it.Next() { key := it.Key() - index := binary.BigEndian.Uint32(key[len(types.RegistrationMachinePrefix):]) value := it.Value() + // fmt.Println("K: ", hex.EncodeToString(key)) + // fmt.Println("v: ", hex.EncodeToString(value)) + + index := binary.BigEndian.Uint32(key) - // TODO: proof - var proof []byte + // fmt.Println("Querying the enclave cold evidence") + + height := ctx.BlockHeight() - 1 + + key = append(types.RegistrationMachinePrefix, key...) + req := &abci.RequestQuery{ + Path: "/store/register/key", // <- your module storeKey + Data: key, // <- the actual key + Height: height, + Prove: true, + } + + resp, err := k.queryer.Query(ctx, req) + + var merkle_proof_serialized []byte = nil + + if err == nil { + if resp != nil { + // fmt.Println("Key: ", hex.EncodeToString(resp.Key)) + // fmt.Println("Value: ", hex.EncodeToString(resp.Value)) + err, merkle_proof_serialized = SerializeMerkleProof(resp.ProofOps.Ops) + } else { + fmt.Println("No Merkle proof for entry: ", hex.EncodeToString(key)) + } + } else { + fmt.Println("Merkle proof query error: ", err) + } - api.SubmitMachineSwap(index, value, proof) + api.SubmitMachineSwap(index, value, merkle_proof_serialized) } return nil diff --git a/x/registration/internal/keeper/test_common.go b/x/registration/internal/keeper/test_common.go index bac1f1d7ec..9a1a20a300 100644 --- a/x/registration/internal/keeper/test_common.go +++ b/x/registration/internal/keeper/test_common.go @@ -136,7 +136,7 @@ func CreateTestInput(t *testing.T, isCheckTx bool, tempDir string, bootstrap boo router := baseapp.NewMsgServiceRouter() // Load default wasm config - keeper := NewKeeper(cdc, runtime.NewKVStoreService(keys[regtypes.StoreKey]), router, registrationmock.MockEnclaveApi{}, tempDir, bootstrap) + keeper := NewKeeper(cdc, runtime.NewKVStoreService(keys[regtypes.StoreKey]), router, registrationmock.MockEnclaveApi{}, tempDir, bootstrap, &baseapp.BaseApp{}) return ctx, keeper } From 535d551e461ea2583b9ecb51c3a49b4809614770 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 6 Apr 2026 09:26:18 +0000 Subject: [PATCH 14/55] misc --- .../shared/block-verifier/src/submit_block_signatures.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs index f3b401a5c0..9787022e6b 100644 --- a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs +++ b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs @@ -135,7 +135,7 @@ pub unsafe fn submit_block_signatures_impl( let apphash = header.header().app_hash.as_bytes(); if apphash.len() == 32 { - println!("saving apphash: {}", hex::encode(apphash)); + //println!("saving apphash: {}", hex::encode(apphash)); { let mut extra = KEY_MANAGER.extra_data.lock().unwrap(); From 20e60a514e194a69f38f2352244ecbfe4bc87731 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 6 Apr 2026 10:50:45 +0000 Subject: [PATCH 15/55] warning fix --- .../shared/block-verifier/src/submit_block_signatures.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs index 9787022e6b..dcf1dd767e 100644 --- a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs +++ b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs @@ -16,8 +16,6 @@ macro_rules! unwrap_or_return { use crate::txs::tx_from_bytes; use crate::wasm_messages::VERIFIED_BLOCK_MESSAGES; -use sha2::{Digest, Sha256}; - const MAX_VARIABLE_LENGTH: u32 = 100_000; const MAX_BLOCK_DATA_LENGTH: u32 = 22_020_096; // 21 MiB = max block size const RANDOM_PROOF_LEN: u32 = 80; From 06359c97d3a338e01504b11266a0abc05144b454 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 6 Apr 2026 10:51:38 +0000 Subject: [PATCH 16/55] enclave: misc --- .../execute/src/registration/attestation.rs | 27 +++++++++++++++++++ .../src/registration/check_patch_level.rs | 23 +++++++--------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index 61a62567c3..be148c9779 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -415,6 +415,33 @@ lazy_static::lazy_static! { "20806EB70000", "20906EC10000", ]); + + pub static ref SELF_QUOTE_UNTESTED: Result = { + #[cfg(feature = "SGX_MODE_HW")] + { + get_quote_ecdsa_untested(&[]) + } + + #[cfg(not(feature = "SGX_MODE_HW"))] + { + Err(sgx_types::sgx_status_t::SGX_ERROR_NO_DEVICE) + } + }; + + pub static ref SELF_QUOTE_PPID: Option> = { + match &*SELF_QUOTE_UNTESTED { + Ok(x) => unsafe { x.extract_cpu_cert() }, + _ => None + } + }; + + pub static ref SELF_MACHINE_ID: Option = { + let ppid = SELF_QUOTE_PPID.as_ref()?; + let machine_id = crate::registration::offchain::calculate_truncated_hash(&ppid); + trace!("Self machine_id = {}", hex::encode(&machine_id)); + Some(machine_id) + }; + } unsafe fn extract_fmspc_from_collateral(vec_coll: &[u8]) -> Option { diff --git a/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs b/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs index 50966289fa..5d4761a264 100644 --- a/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs +++ b/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs @@ -8,10 +8,9 @@ use enclave_ffi_types::NodeAuthResult; use enclave_utils::validate_const_ptr; #[cfg(feature = "SGX_MODE_HW")] -use crate::registration::attestation::get_quote_ecdsa_untested; - -#[cfg(feature = "SGX_MODE_HW")] -use crate::registration::attestation::verify_quote_sgx; +use crate::registration::attestation::{ + get_quote_ecdsa_untested, verify_quote_sgx, SELF_QUOTE_PPID, SELF_QUOTE_UNTESTED, +}; #[cfg(feature = "SGX_MODE_HW")] use enclave_utils::storage::write_to_untrusted; @@ -39,8 +38,8 @@ pub unsafe extern "C" fn ecall_check_patch_level( } #[cfg(feature = "SGX_MODE_HW")] -unsafe fn check_patch_level_dcap(pub_k: &[u8; 32]) -> (NodeAuthResult, Option>) { - match get_quote_ecdsa_untested(pub_k) { +unsafe fn check_patch_level_dcap() -> NodeAuthResult { + match &*SELF_QUOTE_UNTESTED { Ok(attestation) => { match verify_quote_sgx(&attestation, 0, false) { Ok(res) => { @@ -48,10 +47,8 @@ unsafe fn check_patch_level_dcap(pub_k: &[u8; 32]) -> (NodeAuthResult, Option { println!("DCAP quote obtained, but failed to verify it: {}", e); @@ -65,7 +62,7 @@ unsafe fn check_patch_level_dcap(pub_k: &[u8; 32]) -> (NodeAuthResult, Option Date: Tue, 7 Apr 2026 08:32:19 +0000 Subject: [PATCH 17/55] enclave: enforcing allow-list during runtime --- .../execute/src/registration/attestation.rs | 19 +++++++++++++++++++ .../execute/src/registration/offchain.rs | 17 ++++++++++------- .../src/submit_block_signatures.rs | 14 ++++++++++++-- .../enclaves/shared/utils/src/key_manager.rs | 5 +++++ 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index be148c9779..caaa93751d 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -110,6 +110,10 @@ pub mod allow_list { use std::collections::HashMap; + use enclave_utils::KEY_MANAGER; + + use crate::registration::attestation::SELF_MACHINE_ID; + pub const MACHINE_ID_LEN: usize = 20; pub const OWNER_LEN: usize = 32; @@ -146,6 +150,17 @@ pub mod allow_list { } } + fn on_machine_changed(&mut self, machine: &MachineID, added: bool) { + if let Some(my_machine) = SELF_MACHINE_ID.as_ref() { + if my_machine == machine { + println!("Self machine included: {}", added); + + let mut extra = KEY_MANAGER.extra_data.lock().unwrap(); + extra.machine_allowed = added; + } + } + } + pub fn update( &mut self, machine: &MachineID, @@ -191,6 +206,9 @@ pub mod allow_list { self.m_to_o.remove(&old_machine); self.m_to_o.insert(*machine, *owner); + self.on_machine_changed(&old_machine, false); + self.on_machine_changed(machine, true); + Some((old_machine, *owner)) } } @@ -198,6 +216,7 @@ pub mod allow_list { pub fn add_new(&mut self, machine: MachineID) -> bool { if let std::collections::hash_map::Entry::Vacant(e) = self.m_to_o.entry(machine) { e.insert([0u8; OWNER_LEN]); + self.on_machine_changed(&machine, true); true } else { false diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index fedfe89f4d..a4eb9a6e6c 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -1,6 +1,8 @@ //! use super::attestation::get_quote_ecdsa; -use crate::registration::attestation::{allow_list, verify_quote_sgx, AttestationCombined}; +use crate::registration::attestation::{ + allow_list, verify_quote_sgx, AttestationCombined, PPID_WHITELIST, +}; #[cfg(feature = "verify-validator-whitelist")] use block_verifier::validator_whitelist; use core::convert::TryInto; @@ -45,6 +47,9 @@ use super::seed_exchange::{decrypt_seed, encrypt_seed}; #[cfg(feature = "light-client-validation")] use block_verifier::VERIFIED_BLOCK_MESSAGES; +fn enforce_allow_list_init() { + let _ = &*PPID_WHITELIST; +} /// /// `ecall_init_bootstrap` /// @@ -120,6 +125,8 @@ pub unsafe extern "C" fn ecall_get_network_pubkey( *p_seeds = 0; } + enforce_allow_list_init(); + sgx_status_t::SGX_SUCCESS } @@ -856,9 +863,7 @@ pub unsafe extern "C" fn ecall_onchain_approve_machine_id( } { - let mut allow_list = crate::registration::attestation::PPID_WHITELIST - .lock() - .unwrap(); + let mut allow_list = PPID_WHITELIST.lock().unwrap(); let machine_id: &allow_list::MachineID = machine_id.try_into().unwrap(); @@ -1061,9 +1066,7 @@ pub unsafe extern "C" fn ecall_submit_machine_swap( .unwrap(); { - let mut allow_list = crate::registration::attestation::PPID_WHITELIST - .lock() - .unwrap(); + let mut allow_list = PPID_WHITELIST.lock().unwrap(); if let Some(swap_info) = swap_info_opt { if allow_list diff --git a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs index dcf1dd767e..8b23e13ec7 100644 --- a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs +++ b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs @@ -61,12 +61,22 @@ pub unsafe fn submit_block_signatures_impl( }; let (validator_set, height) = { - let extra = KEY_MANAGER.extra_data.lock().unwrap(); + let mut extra = KEY_MANAGER.extra_data.lock().unwrap(); + + if extra.last_submitted_header_height == 0 { + extra.last_submitted_header_height = extra.height; + } else { + if (extra.last_submitted_header_height != extra.height) && !extra.machine_allowed { + error!("This machine isn't allowed to run"); + return sgx_status_t::SGX_ERROR_INVALID_PARAMETER; + } + } + let validator_set = match extra.decode_validator_set() { Some(set) => set, None => { error!("Error parsing validator set from proto"); - return sgx_status_t::SGX_SUCCESS; + return sgx_status_t::SGX_ERROR_INVALID_PARAMETER; } }; diff --git a/cosmwasm/enclaves/shared/utils/src/key_manager.rs b/cosmwasm/enclaves/shared/utils/src/key_manager.rs index 0216690277..949ac48504 100644 --- a/cosmwasm/enclaves/shared/utils/src/key_manager.rs +++ b/cosmwasm/enclaves/shared/utils/src/key_manager.rs @@ -43,6 +43,9 @@ pub struct KeychainMutableData { pub validator_set_serialized: Vec, pub next_mr_enclave: Option, pub last_block_seed: u16, + // the following is NOT serialized + pub last_submitted_header_height: u64, + pub machine_allowed: bool, } impl KeychainMutableData { @@ -302,6 +305,8 @@ impl Keychain { validator_set_serialized: Vec::new(), next_mr_enclave: None, last_block_seed: DEF_LAST_BLOCK_SEED, + last_submitted_header_height: 0, + machine_allowed: false, }), } } From e0a032e5be8dc0f2359fa35885120cb7d4e8f4b5 Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 9 Apr 2026 11:35:16 +0000 Subject: [PATCH 18/55] RaAuthenticate: added replace_machine_id, passing it to the enclave --- cosmwasm/packages/sgx-vm/src/attestation.rs | 4 +- go-cosmwasm/api/bindings.h | 2 +- go-cosmwasm/api/lib.go | 6 +- go-cosmwasm/api/lib_mock.go | 2 +- go-cosmwasm/src/lib.rs | 12 +- proto/secret/registration/v1beta1/msg.proto | 2 + x/registration/handler.go | 2 +- .../internal/keeper/enclave/enclave.go | 4 +- .../internal/keeper/enclave_interface.go | 2 +- x/registration/internal/keeper/keeper.go | 14 ++- .../internal/keeper/mock/enclave.go | 2 +- x/registration/internal/keeper/msg_server.go | 2 +- x/registration/internal/types/msg.pb.go | 112 +++++++++++++----- 13 files changed, 118 insertions(+), 48 deletions(-) diff --git a/cosmwasm/packages/sgx-vm/src/attestation.rs b/cosmwasm/packages/sgx-vm/src/attestation.rs index a30b5c17d5..8f5fa1b3d8 100644 --- a/cosmwasm/packages/sgx-vm/src/attestation.rs +++ b/cosmwasm/packages/sgx-vm/src/attestation.rs @@ -59,6 +59,7 @@ pub fn create_attestation_report_u(p_sk: *const u8, n_sk: u32, flags: u32) -> Sg pub fn untrusted_get_encrypted_seed( cert: &[u8], + replace_machine: &[u8], ) -> SgxResult, Vec), NodeAuthResult>> { // Bind the token to a local variable to ensure its // destructor runs in the end of the function @@ -73,7 +74,6 @@ pub fn untrusted_get_encrypted_seed( seed_buffer.resize(SINGLE_ENCRYPTED_SEED_SIZE * 100, 0); // should be enough. Resize in later version, when approaching the limit let mut seeds_size: u32 = 0; - let machine_pop = [0_u8; 20]; // TODO - pass hint let mut machine_add_del = [0_u8; 104]; let status = unsafe { @@ -85,7 +85,7 @@ pub fn untrusted_get_encrypted_seed( seed_buffer.as_mut_ptr(), seed_buffer.len() as u32, &mut seeds_size, - machine_pop.as_ptr(), + replace_machine.as_ptr(), machine_add_del.as_mut_ptr(), ) }; diff --git a/go-cosmwasm/api/bindings.h b/go-cosmwasm/api/bindings.h index 47ff68a4d1..d57a7e9964 100644 --- a/go-cosmwasm/api/bindings.h +++ b/go-cosmwasm/api/bindings.h @@ -166,7 +166,7 @@ Buffer get_code(cache_t *cache, Buffer id, Buffer *err); Buffer get_encrypted_genesis_seed(Buffer pk, Buffer *err); -TwoBuffers get_encrypted_seed(Buffer cert, Buffer *err); +TwoBuffers get_encrypted_seed(Buffer cert, Buffer replace_machine, Buffer *err); Buffer get_health_check(Buffer *err); diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index d1653d513b..68909df7ec 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -542,11 +542,13 @@ func CreateAttestationReport(ext_sk []byte, is_migration_report bool) (bool, err return true, nil } -func GetEncryptedSeed(cert []byte) ([]byte, []byte, error) { +func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, error) { errmsg := C.Buffer{} certSlice := sendSlice(cert) defer freeAfterSend(certSlice) - res, err := C.get_encrypted_seed(certSlice, &errmsg) + replace_machine_slice := sendSlice(replace_machine_id) + defer freeAfterSend(replace_machine_slice) + res, err := C.get_encrypted_seed(certSlice, replace_machine_slice, &errmsg) if err != nil { return nil, nil, errorWithMessage(err, errmsg) } diff --git a/go-cosmwasm/api/lib_mock.go b/go-cosmwasm/api/lib_mock.go index fc9036d661..34c452a341 100644 --- a/go-cosmwasm/api/lib_mock.go +++ b/go-cosmwasm/api/lib_mock.go @@ -285,7 +285,7 @@ func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { return nil, nil } -func GetEncryptedSeed(cert []byte) ([]byte, []byte, error) { +func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, error) { //errmsg := C.Buffer{} //certSlice := sendSlice(cert) //defer freeAfterSend(certSlice) diff --git a/go-cosmwasm/src/lib.rs b/go-cosmwasm/src/lib.rs index 7fbebaac1d..b2e7cc2468 100644 --- a/go-cosmwasm/src/lib.rs +++ b/go-cosmwasm/src/lib.rs @@ -69,7 +69,11 @@ pub extern "C" fn get_health_check(err: Option<&mut Buffer>) -> Buffer { } #[no_mangle] -pub extern "C" fn get_encrypted_seed(cert: Buffer, err: Option<&mut Buffer>) -> TwoBuffers { +pub extern "C" fn get_encrypted_seed( + cert: Buffer, + replace_machine: Buffer, + err: Option<&mut Buffer>, +) -> TwoBuffers { trace!("Called get_encrypted_seed"); let cert_slice = match unsafe { cert.read() } { None => { @@ -78,8 +82,12 @@ pub extern "C" fn get_encrypted_seed(cert: Buffer, err: Option<&mut Buffer>) -> } Some(r) => r, }; + let replace_machine_slice = match unsafe { replace_machine.read() } { + None => &[0u8], + Some(r) => r, + }; trace!("Hello from right before untrusted_get_encrypted_seed"); - match untrusted_get_encrypted_seed(cert_slice) { + match untrusted_get_encrypted_seed(cert_slice, replace_machine_slice) { Err(e) => { // An error happened in the SGX sdk. set_error(Error::enclave_err(e.to_string()), err); diff --git a/proto/secret/registration/v1beta1/msg.proto b/proto/secret/registration/v1beta1/msg.proto index bff90dad40..71a89ee5c8 100644 --- a/proto/secret/registration/v1beta1/msg.proto +++ b/proto/secret/registration/v1beta1/msg.proto @@ -25,6 +25,8 @@ message RaAuthenticate { "remote_attestation.Certificate", (gogoproto.jsontag) = "ra_cert" ]; + + string replace_machine_id = 3; } message RaAuthenticateResponse { diff --git a/x/registration/handler.go b/x/registration/handler.go index af95d9e0b9..d2ea0e0423 100644 --- a/x/registration/handler.go +++ b/x/registration/handler.go @@ -45,7 +45,7 @@ func handleRaAuthenticate(ctx sdk.Context, k Keeper, msg *types.RaAuthenticate) return nil, err } - encSeed, err := k.RegisterNode(ctx, msg.Certificate) + encSeed, err := k.RegisterNode(ctx, msg.Certificate, msg.ReplaceMachineId) if err != nil { return nil, err } diff --git a/x/registration/internal/keeper/enclave/enclave.go b/x/registration/internal/keeper/enclave/enclave.go index eeb9639504..8d58629d3d 100644 --- a/x/registration/internal/keeper/enclave/enclave.go +++ b/x/registration/internal/keeper/enclave/enclave.go @@ -10,8 +10,8 @@ func (Api) LoadSeed(masterKey []byte, seed []byte) (bool, error) { return api.LoadSeedToEnclave(masterKey, seed) } -func (Api) GetEncryptedSeed(masterCert []byte) ([]byte, []byte, error) { - return api.GetEncryptedSeed(masterCert) +func (Api) GetEncryptedSeed(masterCert []byte, replace_machine_id []byte) ([]byte, []byte, error) { + return api.GetEncryptedSeed(masterCert, replace_machine_id) } func (Api) GetEncryptedGenesisSeed(pk []byte) ([]byte, error) { diff --git a/x/registration/internal/keeper/enclave_interface.go b/x/registration/internal/keeper/enclave_interface.go index 59c026fda3..e576090000 100644 --- a/x/registration/internal/keeper/enclave_interface.go +++ b/x/registration/internal/keeper/enclave_interface.go @@ -2,6 +2,6 @@ package keeper type EnclaveInterface interface { LoadSeed(masterKey []byte, seed []byte) (bool, error) - GetEncryptedSeed(masterCert []byte) ([]byte, []byte, error) + GetEncryptedSeed(masterCert []byte, replace_machine_id []byte) ([]byte, []byte, error) GetEncryptedGenesisSeed(pk []byte) ([]byte, error) } diff --git a/x/registration/internal/keeper/keeper.go b/x/registration/internal/keeper/keeper.go index b39036083c..845421554e 100644 --- a/x/registration/internal/keeper/keeper.go +++ b/x/registration/internal/keeper/keeper.go @@ -330,7 +330,7 @@ func (k *Keeper) MaybeSetEnclaveColdData(ctx sdk.Context) error { return nil } -func (k Keeper) RegisterNode(ctx sdk.Context, certificate ra.Certificate) ([]byte, error) { +func (k Keeper) RegisterNode(ctx sdk.Context, certificate ra.Certificate, replace_machine_id string) ([]byte, error) { // fmt.Println("RegisterNode") var encSeed []byte var publicKey []byte @@ -350,8 +350,17 @@ func (k Keeper) RegisterNode(ctx sdk.Context, certificate ra.Certificate) ([]byt // Note: don't skip envoking the enclave even if the node was already registered. // The enclave may realize the new node ownership + var replaceMachineID [20]byte // this is by default + + { + decoded, err := hex.DecodeString(replace_machine_id) + if err == nil && len(decoded) == 20 { + copy(replaceMachineID[:], decoded) + } + } + var machineSwapInfo []byte - encSeed, machineSwapInfo, err = k.enclave.GetEncryptedSeed(certificate) + encSeed, machineSwapInfo, err = k.enclave.GetEncryptedSeed(certificate, replaceMachineID[:]) if err != nil { // return 0, errorsmod.Wrap(err, "cosmwasm create") return nil, errorsmod.Wrap(types.ErrAuthenticateFailed, err.Error()) @@ -361,6 +370,7 @@ func (k Keeper) RegisterNode(ctx sdk.Context, certificate ra.Certificate) ([]byt store_swap_info := make([]byte, 72) copy(store_swap_info[:52], machineSwapInfo[52:52+52]) + copy(store_swap_info[52:72], replaceMachineID[:]) // last 20 bytes are the machine_id_pop - will be added later k.AddMachineSwapInfo(ctx, store_swap_info) diff --git a/x/registration/internal/keeper/mock/enclave.go b/x/registration/internal/keeper/mock/enclave.go index 548cca98a6..643e1431a5 100644 --- a/x/registration/internal/keeper/mock/enclave.go +++ b/x/registration/internal/keeper/mock/enclave.go @@ -8,7 +8,7 @@ func (MockEnclaveApi) LoadSeed(_ []byte, _ []byte) (bool, error) { return true, nil } -func (MockEnclaveApi) GetEncryptedSeed(_ []byte) ([]byte, []byte, error) { +func (MockEnclaveApi) GetEncryptedSeed(_ []byte, _ []byte) ([]byte, []byte, error) { return []byte(""), nil, nil } diff --git a/x/registration/internal/keeper/msg_server.go b/x/registration/internal/keeper/msg_server.go index c14a71e9fe..3f58080d26 100644 --- a/x/registration/internal/keeper/msg_server.go +++ b/x/registration/internal/keeper/msg_server.go @@ -41,7 +41,7 @@ func (m msgServer) RegisterAuth(goCtx context.Context, msg *types.RaAuthenticate return nil, err } - encSeed, err := m.keeper.RegisterNode(ctx, msg.Certificate) + encSeed, err := m.keeper.RegisterNode(ctx, msg.Certificate, msg.ReplaceMachineId) if err != nil { return nil, err } diff --git a/x/registration/internal/types/msg.pb.go b/x/registration/internal/types/msg.pb.go index 9739432699..278ff6cdcf 100644 --- a/x/registration/internal/types/msg.pb.go +++ b/x/registration/internal/types/msg.pb.go @@ -33,8 +33,9 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type RaAuthenticate struct { - Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` - Certificate github_com_scrtlabs_SecretNetwork_x_registration_remote_attestation.Certificate `protobuf:"bytes,2,opt,name=certificate,proto3,casttype=github.com/scrtlabs/SecretNetwork/x/registration/remote_attestation.Certificate" json:"ra_cert"` + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` + Certificate github_com_scrtlabs_SecretNetwork_x_registration_remote_attestation.Certificate `protobuf:"bytes,2,opt,name=certificate,proto3,casttype=github.com/scrtlabs/SecretNetwork/x/registration/remote_attestation.Certificate" json:"ra_cert"` + ReplaceMachineId string `protobuf:"bytes,3,opt,name=replace_machine_id,json=replaceMachineId,proto3" json:"replace_machine_id,omitempty"` } func (m *RaAuthenticate) Reset() { *m = RaAuthenticate{} } @@ -194,36 +195,37 @@ func init() { } var fileDescriptor_91e653c4cfa6dfea = []byte{ - // 449 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xb1, 0x6e, 0x13, 0x41, - 0x10, 0xbd, 0xc5, 0xc4, 0x91, 0x97, 0x08, 0xa4, 0x55, 0x14, 0x82, 0x91, 0xee, 0x82, 0x25, 0x24, - 0x14, 0x94, 0x5b, 0x99, 0x74, 0x34, 0xc8, 0x81, 0x06, 0xa1, 0x80, 0xb4, 0x74, 0x14, 0x44, 0x7b, - 0x7b, 0xc3, 0xe5, 0xe4, 0xf8, 0xd6, 0xda, 0x99, 0x18, 0xdc, 0xa0, 0x88, 0x8a, 0x92, 0x4f, 0xa0, - 0xa4, 0xcc, 0x67, 0xa4, 0x4c, 0x49, 0x65, 0x81, 0x5d, 0x44, 0x4a, 0x43, 0x9f, 0x0a, 0xdd, 0xde, - 0x21,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, 0xdb, 0x02, 0x00, - 0x00, + // 479 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x3d, 0x6f, 0xd3, 0x50, + 0x14, 0xb5, 0x1b, 0x9a, 0x2a, 0x8f, 0x0a, 0xd0, 0x53, 0x55, 0x42, 0x90, 0xec, 0x10, 0x09, 0xa9, + 0x2a, 0xd4, 0x56, 0xe8, 0xc6, 0x82, 0x52, 0x58, 0x2a, 0x14, 0x90, 0x1e, 0x1b, 0x03, 0xd1, 0xf3, + 0xf3, 0xc5, 0xb1, 0x12, 0xfb, 0x59, 0xef, 0xde, 0x06, 0xb2, 0xa0, 0x8a, 0x89, 0x91, 0x3f, 0x80, + 0xc4, 0xc8, 0xd8, 0x9f, 0xd1, 0xb1, 0x23, 0x53, 0x04, 0xc9, 0x50, 0xa9, 0x3f, 0xa1, 0x13, 0xf2, + 0x07, 0x22, 0x59, 0x90, 0xb2, 0xd8, 0xf7, 0xea, 0x1c, 0x9f, 0x7b, 0xcf, 0xf1, 0x65, 0x0f, 0x11, + 0x94, 0x01, 0xf2, 0x0d, 0x44, 0x31, 0x92, 0x91, 0x14, 0xeb, 0xd4, 0x9f, 0x74, 0x03, 0x20, 0xd9, + 0xf5, 0x13, 0x8c, 0xbc, 0xcc, 0x68, 0xd2, 0xfc, 0x7e, 0x49, 0xf3, 0x96, 0x69, 0x5e, 0x45, 0x6b, + 0xed, 0x44, 0x3a, 0xd2, 0x05, 0xcf, 0xcf, 0xab, 0xf2, 0x93, 0xd6, 0x5d, 0xa5, 0x31, 0xd1, 0x98, + 0x8b, 0xf8, 0x93, 0x25, 0xad, 0xce, 0xb7, 0x0d, 0x76, 0x4b, 0xc8, 0xde, 0x09, 0x0d, 0x21, 0xa5, + 0x58, 0x49, 0x02, 0x7e, 0xcc, 0xea, 0x08, 0x69, 0x08, 0xa6, 0x69, 0xb7, 0xed, 0xbd, 0xed, 0xa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0x94, 0x00, 0xcb, 0x78, 0x45, 0xd9, 0x74, 0xda, 0xac, 0x96, 0x83, + 0xf7, 0x58, 0x6d, 0x04, 0xd3, 0x2a, 0xf9, 0xad, 0xab, 0x99, 0x9b, 0xb7, 0x22, 0x7f, 0x3c, 0xf9, + 0xc4, 0x6a, 0x7d, 0x8c, 0x78, 0xc6, 0xb6, 0x45, 0x11, 0x06, 0x98, 0x7c, 0x2f, 0xfe, 0xc8, 0xfb, + 0xcf, 0x39, 0x78, 0xab, 0xcb, 0xb7, 0x0e, 0xd7, 0x20, 0xff, 0x75, 0xda, 0xda, 0x3c, 0xbd, 0x3c, + 0xdb, 0xb7, 0x8f, 0xe4, 0xf9, 0x6f, 0xc7, 0xfa, 0x31, 0x77, 0xec, 0xf3, 0xb9, 0x63, 0x5f, 0xcc, + 0x1d, 0xfb, 0xd7, 0xdc, 0xb1, 0xbf, 0x2e, 0x1c, 0xeb, 0x62, 0xe1, 0x58, 0x3f, 0x17, 0x8e, 0xf5, + 0xf6, 0xd9, 0xda, 0x7f, 0x32, 0x4e, 0x09, 0x4c, 0x2a, 0xc7, 0xe5, 0x09, 0x05, 0xf5, 0xe2, 0x28, + 0x0f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x9c, 0xf4, 0x2c, 0x09, 0x03, 0x00, 0x00, } func (this *RaAuthenticate) Equal(that interface{}) bool { @@ -251,6 +253,9 @@ func (this *RaAuthenticate) Equal(that interface{}) bool { if !bytes.Equal(this.Certificate, that1.Certificate) { return false } + if this.ReplaceMachineId != that1.ReplaceMachineId { + return false + } return true } func (this *RaAuthenticateResponse) Equal(that interface{}) bool { @@ -431,6 +436,13 @@ func (m *RaAuthenticate) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ReplaceMachineId) > 0 { + i -= len(m.ReplaceMachineId) + copy(dAtA[i:], m.ReplaceMachineId) + i = encodeVarintMsg(dAtA, i, uint64(len(m.ReplaceMachineId))) + i-- + dAtA[i] = 0x1a + } if len(m.Certificate) > 0 { i -= len(m.Certificate) copy(dAtA[i:], m.Certificate) @@ -570,6 +582,10 @@ func (m *RaAuthenticate) Size() (n int) { if l > 0 { n += 1 + l + sovMsg(uint64(l)) } + l = len(m.ReplaceMachineId) + if l > 0 { + n += 1 + l + sovMsg(uint64(l)) + } return n } @@ -719,6 +735,38 @@ func (m *RaAuthenticate) Unmarshal(dAtA []byte) error { m.Certificate = []byte{} } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReplaceMachineId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMsg + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMsg + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMsg + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ReplaceMachineId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipMsg(dAtA[iNdEx:]) From 0b4924c8020310276ecee095809b274cf9f8bee9 Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 9 Apr 2026 13:29:22 +0000 Subject: [PATCH 19/55] enclave: cosmetic (using hex_literal) --- cosmwasm/enclaves/Cargo.lock | 13 +- cosmwasm/enclaves/execute/Cargo.toml | 2 +- .../execute/src/registration/attestation.rs | 300 +++++++++--------- 3 files changed, 164 insertions(+), 151 deletions(-) diff --git a/cosmwasm/enclaves/Cargo.lock b/cosmwasm/enclaves/Cargo.lock index 07a2360370..121f585095 100644 --- a/cosmwasm/enclaves/Cargo.lock +++ b/cosmwasm/enclaves/Cargo.lock @@ -1010,6 +1010,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + [[package]] name = "home" version = "0.5.9" @@ -1807,6 +1813,7 @@ dependencies = [ "enclave_crypto", "enclave_utils", "hex", + "hex-literal", "httparse", "itertools 0.8.2", "lazy_static", @@ -2206,7 +2213,7 @@ dependencies = [ [[package]] name = "tendermint" version = "0.38.0" -source = "git+https://github.com/scrtlabs/tendermint-rs?tag=v0.38.0-secret.7-beta#945e948889ddc56414d081efd56a7b7ca7449aa4" +source = "git+https://github.com/scrtlabs/tendermint-rs?tag=v0.38.0-secret.7#cebe0ae2b16f0f4876abb2a90903ddce1cbfe7d0" dependencies = [ "bytes 1.7.1", "digest 0.10.7", @@ -2234,7 +2241,7 @@ dependencies = [ [[package]] name = "tendermint-light-client-verifier" version = "0.38.0" -source = "git+https://github.com/scrtlabs/tendermint-rs?tag=v0.38.0-secret.7-beta#945e948889ddc56414d081efd56a7b7ca7449aa4" +source = "git+https://github.com/scrtlabs/tendermint-rs?tag=v0.38.0-secret.7#cebe0ae2b16f0f4876abb2a90903ddce1cbfe7d0" dependencies = [ "derive_more", "flex-error", @@ -2246,7 +2253,7 @@ dependencies = [ [[package]] name = "tendermint-proto" version = "0.38.0" -source = "git+https://github.com/scrtlabs/tendermint-rs?tag=v0.38.0-secret.7-beta#945e948889ddc56414d081efd56a7b7ca7449aa4" +source = "git+https://github.com/scrtlabs/tendermint-rs?tag=v0.38.0-secret.7#cebe0ae2b16f0f4876abb2a90903ddce1cbfe7d0" dependencies = [ "bytes 1.7.1", "flex-error", diff --git a/cosmwasm/enclaves/execute/Cargo.toml b/cosmwasm/enclaves/execute/Cargo.toml index 2ae245340e..3c2d6da1bb 100644 --- a/cosmwasm/enclaves/execute/Cargo.toml +++ b/cosmwasm/enclaves/execute/Cargo.toml @@ -95,7 +95,7 @@ tendermint-proto = { git = "https://github.com/scrtlabs/tendermint-rs", tag = "v tendermint-light-client-verifier = { git = "https://github.com/scrtlabs/tendermint-rs", tag = "v0.38.0-secret.7", default-features = false, features = ["rust-crypto"] } rsa = { version = "0.9", default-features = false, features = ["sha2"] } base64ct = { version = "1.6", default-features = false, features = ["alloc"] } - +hex-literal = "0.4" [dependencies.webpki] git = "https://github.com/mesalock-linux/webpki" diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index 727fedee46..24ece2b1a0 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -262,153 +262,159 @@ lazy_static::lazy_static! { pub static ref PPID_WHITELIST: SgxMutex = { let mut set: HashSet<[u8; 20]> = HashSet::new(); - set.insert([0x01,0x50,0x7c,0x95,0x77,0x89,0xb7,0xc1,0xaf,0xde,0x97,0x2d,0x67,0xf1,0xfd,0xd5,0x3a,0xf1,0xa8,0xda]); - set.insert([0x03,0x37,0x2b,0x2a,0x39,0xe0,0x71,0x3c,0x96,0x5a,0x08,0x76,0xb5,0xe8,0x07,0xb4,0x1d,0x50,0x95,0x38]); - set.insert([0x04,0xf0,0x14,0x07,0xb7,0x62,0xaf,0x16,0xdb,0x04,0xac,0x64,0x8a,0xee,0x5f,0xeb,0x24,0xcf,0x6e,0xb8]); - set.insert([0x05,0x04,0x30,0x40,0x8a,0x4c,0xea,0xe5,0xd0,0xb9,0xd9,0x57,0x21,0xd6,0x51,0x22,0x2c,0xbd,0x83,0xd3]); - set.insert([0x05,0x1f,0x83,0xeb,0x42,0xdf,0xdd,0x78,0x50,0x08,0x6c,0xf5,0x69,0x6f,0xbb,0x36,0x53,0xf8,0x83,0xae]); - set.insert([0x09,0xe9,0x87,0x5e,0xd7,0xac,0xd4,0x2c,0x7d,0xd1,0x9d,0x72,0xa3,0x95,0x24,0xf6,0xae,0x3e,0x87,0xfa]); - set.insert([0x11,0x21,0xe6,0xd9,0xa7,0x70,0xc9,0xe5,0x62,0xae,0x42,0x30,0x12,0x08,0x0e,0x52,0x76,0x5e,0xcf,0x71]); - set.insert([0x13,0xf1,0x08,0xbd,0xf8,0xfd,0x3f,0x11,0xe7,0x50,0x26,0xd9,0x8e,0xd1,0x80,0x30,0x75,0x25,0x73,0x54]); - set.insert([0x14,0xd1,0x23,0x60,0x33,0xfd,0xe3,0x1e,0x0b,0xcd,0x57,0x0c,0x32,0x91,0xea,0xa9,0xbd,0xb7,0xe2,0x5e]); - set.insert([0x16,0x32,0xea,0x13,0x05,0x1c,0xc4,0xd3,0x92,0xcb,0x8d,0x3e,0x01,0x6e,0xb5,0x61,0x7d,0x8e,0x8b,0x2a]); - set.insert([0x18,0x81,0x20,0xcd,0x27,0xf6,0x58,0xa7,0x29,0x2c,0x46,0x6f,0x6c,0x7d,0xf5,0xaf,0x6c,0xdb,0x96,0x6e]); - set.insert([0x1a,0x24,0x25,0xc4,0x95,0x55,0x55,0xf0,0xea,0x8c,0x03,0x15,0xe1,0x16,0xe0,0x13,0x5f,0x3a,0x04,0xc9]); - set.insert([0x1a,0xe4,0xfb,0x51,0x62,0x6d,0x0d,0x27,0x4c,0x0b,0xd3,0x85,0x1e,0x5a,0x04,0xde,0xe0,0xb0,0xd5,0x3b]); - set.insert([0x1b,0x3a,0xad,0xe4,0x41,0xad,0xd6,0x58,0xf9,0xf9,0x5c,0x10,0xce,0x0f,0x3d,0x75,0x4f,0x92,0xa3,0x27]); - set.insert([0x1c,0x8b,0xe8,0x11,0xc0,0x91,0x85,0xa9,0xf6,0xc7,0xdc,0x3f,0xba,0x81,0xe8,0x78,0xa5,0x8d,0x0a,0x1b]); - set.insert([0x20,0x59,0x8f,0xcb,0x4b,0xa5,0x79,0xc5,0xa0,0x9e,0x8c,0x1a,0x42,0xec,0x9c,0x02,0x10,0xcb,0x43,0xf3]); - set.insert([0x20,0x87,0x68,0x85,0x22,0x96,0x5e,0xb0,0x4c,0x9a,0xe9,0xf3,0x3e,0xa9,0x4b,0xbf,0x82,0x08,0x78,0xf1]); - set.insert([0x21,0x1f,0x0f,0x55,0x70,0xf7,0xaa,0xbf,0xe6,0xa8,0xb7,0xcf,0x77,0xde,0xc8,0xd3,0x3d,0xd5,0xfe,0xea]); - set.insert([0x21,0xca,0xe8,0x22,0x31,0x4c,0x17,0x72,0x16,0x77,0xc4,0x1c,0xd8,0x42,0x34,0x64,0x98,0x35,0x53,0xc1]); - set.insert([0x22,0x1c,0xd8,0x23,0x4e,0x36,0x9e,0xf1,0x9d,0xfd,0xad,0x94,0xf4,0x37,0xd3,0xa1,0x90,0xcb,0x26,0x73]); - set.insert([0x24,0x91,0xb9,0xa2,0x2f,0x4b,0x3d,0x45,0x82,0xaf,0x20,0x92,0x19,0x19,0xbc,0x27,0x71,0xc8,0x0f,0xde]); - set.insert([0x26,0x67,0x1a,0x09,0x31,0xeb,0xde,0x25,0x27,0x37,0x36,0xbf,0x6b,0x4b,0x2e,0xd1,0x03,0x8c,0x44,0x43]); - set.insert([0x28,0x04,0x9f,0x3f,0x69,0xf6,0x55,0x83,0x24,0xe5,0x2d,0x44,0xec,0xde,0xf8,0x97,0xb1,0xa3,0xb3,0x90]); - set.insert([0x28,0x54,0xe3,0xe3,0x89,0x49,0x86,0x16,0x8e,0x90,0xce,0x3a,0x01,0x7b,0xfe,0xcf,0x65,0xce,0x79,0x11]); - set.insert([0x29,0xf3,0xc4,0x1b,0xbf,0x0d,0xbd,0x38,0xfd,0x4b,0x05,0x2d,0x27,0xca,0x64,0x86,0xa9,0x06,0x68,0x8d]); - set.insert([0x2a,0x00,0x3f,0x2b,0x90,0x8b,0x08,0x47,0x6b,0xe2,0x5d,0x01,0x1c,0x57,0xfe,0x11,0xfc,0x68,0x92,0xf9]); - set.insert([0x30,0x7b,0xbc,0xfb,0x24,0xab,0xdb,0x94,0xa6,0xb7,0xca,0xba,0xdd,0xb9,0x19,0x04,0x64,0x03,0xff,0xe6]); - set.insert([0x31,0x5d,0xb0,0x4d,0xf6,0x69,0x89,0x4a,0x3e,0x35,0x42,0x96,0x91,0xb8,0xb3,0x50,0xd8,0xcb,0xcd,0xe2]); - set.insert([0x32,0xea,0x0b,0xc9,0x08,0x31,0xa8,0xfb,0x98,0x8c,0x20,0x8e,0x53,0x28,0xac,0x7b,0x64,0xeb,0x29,0x8d]); - set.insert([0x34,0x6d,0xf4,0xcc,0xe9,0xf2,0x7b,0x23,0xc5,0xf0,0x82,0x3e,0xe9,0xd2,0x60,0xc1,0x66,0xfe,0xd3,0xdb]); - set.insert([0x35,0x99,0xc4,0x8a,0x2a,0x1b,0xbf,0xf8,0x74,0xda,0xc4,0x6d,0x98,0x6a,0x51,0x2f,0x69,0xfb,0xc8,0xd0]); - set.insert([0x36,0xa3,0x75,0x06,0xdc,0xc6,0x2a,0x21,0x53,0xae,0x3d,0xa7,0x41,0xf5,0x6a,0x01,0xbe,0xd5,0x42,0x67]); - set.insert([0x3e,0x68,0x30,0xd6,0xa2,0xd8,0x39,0xbf,0x36,0xbb,0x10,0x8c,0xa8,0xcc,0xc2,0x5a,0x16,0x78,0xf8,0x2f]); - set.insert([0x40,0x83,0x2a,0x64,0xb2,0x7c,0x12,0xc7,0xab,0xe6,0xbe,0x09,0x47,0x16,0x3e,0xe4,0x83,0x47,0x8c,0x61]); - set.insert([0x41,0x01,0xa8,0x18,0x7d,0x20,0x88,0x9c,0x4f,0xd2,0x47,0xb4,0xc8,0x27,0x9b,0x66,0x31,0x8e,0xf0,0x91]); - set.insert([0x42,0x26,0xd0,0x78,0x02,0x9b,0x9b,0xe4,0xf3,0x2a,0x61,0x5e,0x92,0x90,0xdb,0xcd,0xe3,0xd5,0x5f,0x76]); - set.insert([0x44,0x3b,0x01,0xf0,0x77,0x19,0xd7,0xce,0x6c,0xbd,0xe8,0x61,0x08,0x2a,0x33,0x18,0x1b,0xb2,0x4e,0x4c]); - set.insert([0x44,0xe1,0x05,0x97,0xb4,0x2e,0x57,0x14,0x23,0x91,0x53,0x85,0xfe,0x85,0xce,0xd0,0xe8,0x40,0x85,0x0c]); - set.insert([0x46,0x1b,0xe5,0xde,0x74,0xce,0x83,0x3d,0x38,0x28,0xfc,0xb5,0x7c,0x24,0x3b,0x60,0x15,0xd7,0x6d,0x7f]); - set.insert([0x48,0x82,0x28,0x89,0x4e,0x72,0x65,0xff,0x74,0xd9,0x74,0x95,0xd2,0xd5,0x36,0xb9,0xc7,0xf5,0x74,0x11]); - set.insert([0x4a,0xf5,0xd9,0x4e,0x22,0x81,0xe2,0xa4,0xc2,0x3e,0xd8,0x4c,0x4a,0x05,0xaa,0x5e,0x7a,0x31,0x78,0xd2]); - set.insert([0x4e,0x09,0x78,0x81,0x59,0x00,0x8f,0x91,0xd7,0xf3,0xd6,0x8b,0x1a,0xf2,0x35,0x5b,0x3c,0x17,0x72,0xcc]); - set.insert([0x4f,0xf7,0xe9,0x72,0x4d,0x98,0xc5,0x0d,0x61,0x18,0xf6,0x5f,0x30,0x04,0xa1,0xfc,0xcd,0xed,0x1a,0xd8]); - set.insert([0x50,0x0f,0x64,0x49,0xb9,0x7e,0x2b,0xe1,0xe6,0x8f,0x0c,0xb1,0xed,0x59,0xde,0xe3,0xc8,0xe6,0xd9,0xc0]); - set.insert([0x51,0xc1,0xed,0xe1,0x8e,0x73,0xfc,0x7e,0x00,0xe8,0xfc,0x01,0x8e,0xde,0x53,0x63,0x2f,0x8b,0xb6,0xd9]); - set.insert([0x53,0x54,0x3f,0x1a,0x7d,0x08,0xc1,0x3d,0x69,0x38,0x5b,0x81,0x20,0x56,0x2a,0x76,0xb8,0x71,0xf8,0xec]); - set.insert([0x57,0x19,0x8e,0xb3,0x6e,0x5c,0x99,0x68,0x63,0xb6,0x26,0xeb,0x6f,0x23,0xe3,0x87,0x7c,0xb2,0xed,0x17]); - set.insert([0x57,0xa6,0x87,0x7d,0x0e,0x96,0xce,0x77,0xa3,0xfa,0xfb,0x0c,0x2f,0x7e,0x9e,0xd9,0xe2,0x8f,0xb0,0x37]); - set.insert([0x5a,0xf0,0xf7,0x3c,0x1e,0x99,0xf5,0x5f,0x27,0xd0,0x22,0x40,0x0f,0x5c,0x4b,0x92,0x16,0x59,0x35,0x32]); - set.insert([0x5d,0x73,0xa5,0x89,0xb3,0x57,0xf4,0xe7,0xad,0x59,0x9b,0x4a,0x4a,0x7e,0x43,0x38,0xcd,0x73,0x30,0x18]); - set.insert([0x60,0x8a,0x11,0xe7,0xce,0x88,0xe1,0xab,0xd1,0xc5,0x4a,0x35,0x66,0xcc,0x7b,0x63,0x32,0xbe,0x05,0xb5]); - set.insert([0x61,0x89,0x7d,0x03,0x10,0x11,0x02,0x14,0x03,0x5b,0xcb,0xad,0x0f,0x7a,0x46,0xff,0x44,0x7e,0xc0,0xe7]); - set.insert([0x67,0x44,0x97,0x91,0x8b,0x42,0x04,0xd3,0xe6,0x86,0xba,0x23,0x40,0x8a,0x9a,0xa2,0x16,0xb2,0x22,0x7a]); - set.insert([0x68,0x92,0x8a,0xa2,0xc3,0x16,0x7d,0x75,0xd5,0x66,0xe5,0x4b,0x47,0x54,0x62,0xaa,0x28,0x72,0xcb,0x2f]); - set.insert([0x69,0x25,0xe6,0x6c,0x41,0xbb,0x7e,0x7f,0x5e,0xc3,0x80,0x8f,0x7a,0xe7,0xa0,0x5c,0x41,0x9f,0xec,0xc4]); - set.insert([0x6a,0x81,0xac,0x2a,0x32,0xcc,0x2e,0xac,0x4b,0x97,0x4b,0x18,0x19,0xed,0x2b,0x75,0x68,0xc8,0x3c,0x04]); - set.insert([0x6c,0xe7,0x2a,0xa2,0x20,0x18,0x62,0x2c,0x24,0xa2,0xc0,0xaa,0xc4,0x5f,0x14,0x61,0x7a,0xec,0x59,0xe5]); - set.insert([0x70,0xb9,0x31,0x35,0x3e,0x39,0x25,0xbb,0xf3,0xdd,0x70,0x04,0x6f,0x32,0x91,0x1c,0x97,0x61,0xfc,0xa6]); - set.insert([0x74,0x02,0xb6,0x3c,0x09,0xf3,0x52,0x09,0x31,0xda,0xc2,0xf9,0xf7,0x02,0xce,0x16,0x50,0x3d,0x36,0x48]); - set.insert([0x78,0x27,0x70,0x25,0x3c,0x0a,0xe7,0x2e,0xdd,0x91,0x13,0x8a,0xd0,0x01,0x7c,0xdb,0x9a,0x7d,0x8d,0xba]); - set.insert([0x79,0x17,0x73,0xaa,0x0b,0x8a,0xe2,0xdc,0x8c,0xb7,0x5e,0xb9,0xd5,0x64,0xa0,0xd5,0x98,0x12,0x55,0x72]); - set.insert([0x7a,0x89,0xc9,0xdd,0x73,0x83,0xdd,0xe2,0x74,0x19,0xb3,0x6e,0x2c,0x6d,0x0d,0x94,0x2e,0xee,0x85,0xd9]); - set.insert([0x7d,0x0a,0xf9,0xbb,0xd9,0x4b,0xc0,0xcc,0xa2,0x26,0x84,0xe8,0x6a,0xc6,0x2b,0x58,0xe5,0x13,0x42,0x23]); - set.insert([0x7f,0x1c,0x69,0x94,0x72,0x96,0x37,0xe3,0xfd,0x4c,0xc2,0xf5,0xfa,0xae,0xb9,0xbf,0xfb,0x17,0xc1,0xa2]); - set.insert([0x80,0x3b,0xce,0xe8,0xa4,0x72,0x47,0xaa,0x76,0x2a,0x29,0xd9,0xed,0x59,0xd6,0x3d,0xef,0xc5,0xf8,0x61]); - set.insert([0x80,0xfc,0xb4,0xf6,0xf0,0x86,0xe6,0xbb,0xd8,0x32,0x50,0x0c,0x2b,0x72,0x9c,0x26,0xb3,0xbf,0x1a,0xd2]); - set.insert([0x81,0x3b,0xf8,0x20,0xfd,0x54,0x35,0xd0,0x3d,0xb7,0xbb,0xeb,0x04,0xd2,0xc3,0x42,0x17,0xf2,0xf9,0x49]); - set.insert([0x84,0xca,0x01,0x28,0x46,0x31,0x54,0x15,0x12,0x65,0x21,0xd8,0xaf,0xdf,0x5d,0xda,0x5f,0x77,0x53,0x06]); - set.insert([0x87,0x96,0xf5,0x16,0xe2,0x3e,0x15,0x62,0x4e,0x50,0xe6,0xd3,0x4a,0x3a,0xb4,0xd8,0x12,0xfd,0xca,0x7e]); - set.insert([0x8f,0x06,0xc7,0xf4,0xf5,0xf8,0x68,0x42,0xae,0xe7,0x84,0x33,0x70,0x21,0xeb,0xd5,0x9d,0x4a,0xf9,0xf1]); - set.insert([0x8f,0xc9,0x82,0x1d,0xbf,0xa8,0x3b,0x21,0x7f,0x8f,0x61,0xf1,0xf4,0x1f,0x05,0x74,0x25,0xdc,0xd3,0xb6]); - set.insert([0x8f,0xfb,0xc5,0xef,0x59,0xef,0x9f,0x22,0x89,0xe7,0x4a,0x37,0x45,0x03,0x9d,0x90,0x0f,0xba,0x30,0xfe]); - set.insert([0x90,0x48,0xc1,0x42,0xde,0x1f,0xe7,0x0d,0x3e,0xf4,0xa9,0x10,0x7c,0xcf,0xbe,0x23,0x5d,0xf5,0x36,0xc0]); - set.insert([0x92,0x16,0x6c,0x98,0x8e,0x5e,0x02,0x18,0x4b,0xf2,0xd5,0xb3,0xb9,0x7a,0x1e,0x76,0xbd,0x61,0x12,0xfe]); - set.insert([0x93,0xbd,0x0a,0x2c,0x4b,0x01,0xd3,0xfb,0x0f,0x21,0xb0,0x72,0xc0,0x4f,0xee,0xea,0x7e,0x64,0x9a,0xe2]); - set.insert([0x97,0x58,0x7e,0x41,0x8d,0xc1,0xaf,0xbc,0xa9,0x93,0x9c,0x06,0xcc,0xb9,0x7f,0x31,0x15,0xc5,0x8c,0x65]); - set.insert([0x98,0xcb,0x37,0x1d,0x43,0x68,0x2e,0xb8,0x7d,0x6f,0xb1,0xac,0x1c,0x95,0x89,0xd7,0x9f,0xcd,0x69,0xce]); - set.insert([0x9a,0xce,0x47,0xea,0xcb,0xe6,0xab,0x51,0x12,0xbd,0x6d,0x8e,0xbc,0x55,0x5b,0x0f,0xef,0x9f,0x23,0x32]); - set.insert([0x9c,0x80,0xbc,0x6b,0xf4,0x58,0x6e,0xdb,0x26,0x89,0xc3,0x09,0x3a,0x9a,0x0a,0xec,0xa3,0x01,0x48,0x05]); - set.insert([0x9d,0x08,0x17,0x1e,0xc1,0xca,0xe6,0xce,0x1e,0xa0,0xce,0x3f,0x36,0x74,0xfa,0x5d,0x01,0xf6,0xf1,0xb3]); - set.insert([0x9d,0x3f,0x11,0x60,0xd2,0x15,0xe9,0x43,0x8a,0x60,0x1c,0x87,0x71,0xa9,0x72,0xbc,0xeb,0xe0,0x97,0xf0]); - set.insert([0x9e,0x83,0x20,0x46,0x27,0x33,0xed,0x8a,0x12,0x4f,0xc9,0x7d,0x7f,0xdf,0x33,0x84,0x0b,0x6e,0x3a,0x2c]); - set.insert([0x9e,0xbd,0x6f,0x9e,0x55,0x0f,0x0d,0x6d,0xd0,0x0d,0xe5,0x25,0x5f,0x03,0xde,0xd6,0x1e,0x17,0xe2,0xc7]); - set.insert([0xa0,0x2f,0x25,0xaf,0xce,0x5e,0xea,0xb3,0x21,0xa4,0xe7,0x69,0x43,0xe5,0x6d,0x6e,0x9a,0xa7,0x3f,0xe4]); - set.insert([0xa0,0x41,0x7d,0x62,0x7d,0x22,0x5e,0x21,0x54,0x3c,0xf9,0xa9,0x1b,0x2d,0x83,0xb9,0x5f,0x09,0x1d,0xc6]); - set.insert([0xa4,0x0b,0x94,0x76,0xfb,0x30,0x5c,0x1d,0x39,0x75,0x2f,0xd4,0x85,0x48,0xc5,0xfa,0x3c,0x37,0x15,0x71]); - set.insert([0xa4,0x68,0x49,0x55,0x2c,0x73,0x63,0x28,0x5b,0xae,0xdb,0x5a,0x6b,0x68,0x14,0x80,0x9a,0x59,0xed,0x92]); - set.insert([0xa6,0xad,0xab,0xb2,0xa2,0x5d,0x23,0x3c,0x62,0xaf,0xd1,0xfc,0x0e,0x99,0x1d,0x25,0x13,0xdc,0x11,0xd4]); - set.insert([0xac,0x47,0xf3,0x11,0x51,0x09,0xba,0xeb,0x98,0xde,0xaf,0xdc,0xbd,0x98,0x01,0x17,0xb4,0xe2,0x86,0xba]); - set.insert([0xaf,0x15,0x78,0xfb,0xef,0x76,0x67,0x2f,0xef,0x3b,0x92,0x50,0xb3,0x0c,0xef,0x40,0x7e,0x78,0xfd,0x26]); - set.insert([0xb2,0xed,0x08,0x99,0x4a,0xe4,0xd6,0xdb,0x46,0xb3,0x16,0xd3,0x84,0x38,0x0f,0x69,0x63,0x64,0x04,0xfa]); - set.insert([0xb2,0xfb,0xe8,0xa9,0xd6,0xb1,0x7f,0x9a,0xf5,0x11,0x0a,0xb5,0x56,0xd8,0xb1,0x44,0xbc,0x74,0x96,0x4d]); - set.insert([0xb3,0xc0,0xa1,0x40,0x68,0x94,0xe9,0x31,0x96,0x1e,0x0f,0xe3,0x4a,0x68,0xbd,0x01,0x48,0x33,0x7e,0x58]); - set.insert([0xb4,0xcd,0xc2,0xe6,0x62,0x0d,0xfd,0x8c,0x5d,0x56,0x50,0x41,0x28,0x47,0x14,0xc3,0x80,0x79,0xc7,0x4c]); - set.insert([0xb7,0xed,0x7f,0x4a,0x12,0x88,0xc9,0x8c,0x49,0xb4,0x6a,0x6a,0xf8,0x56,0x53,0x2e,0x65,0xea,0xed,0xab]); - set.insert([0xbb,0x98,0x12,0x7d,0x89,0xb2,0xe3,0xf4,0xf9,0xdb,0x41,0x0b,0x06,0x0e,0x0a,0xff,0xa4,0x8e,0x07,0xef]); - set.insert([0xbb,0xed,0x9a,0xc0,0xc3,0xb9,0x20,0x3d,0x4d,0xa1,0x9c,0xab,0x34,0xfb,0xfb,0x8c,0xe6,0xa4,0x41,0x1c]); - set.insert([0xbd,0x55,0xe8,0x13,0xdb,0x24,0x5b,0x64,0xf2,0x26,0x9f,0xc7,0x67,0xee,0x1d,0xb1,0x0a,0xd9,0xdf,0x94]); - set.insert([0xbf,0x10,0x1c,0x4d,0xe9,0x0c,0xdc,0x2e,0x66,0x74,0x44,0x38,0x39,0x1f,0x60,0xce,0xa9,0x77,0xc9,0xcc]); - set.insert([0xc1,0x33,0xf0,0xc3,0x75,0x1a,0x90,0x85,0x84,0xdc,0xdf,0x32,0x2d,0x72,0xb5,0x17,0x7c,0x12,0xe7,0x32]); - set.insert([0xc2,0xf7,0xf3,0xb6,0x0a,0xcd,0xe8,0xdd,0xff,0x16,0x71,0x04,0xc5,0x6e,0x1e,0xd5,0xa1,0xe3,0xeb,0x74]); - set.insert([0xc3,0x10,0x8f,0xa4,0x05,0xef,0x44,0xa7,0x1a,0x5d,0x88,0x03,0x21,0xe0,0x9a,0x62,0x0f,0x7f,0x4f,0x76]); - set.insert([0xc3,0x1a,0x7d,0x5c,0x50,0x80,0xd9,0x0a,0x62,0x0d,0x36,0x48,0x54,0xba,0x33,0x6d,0xc8,0x2c,0xb2,0xc1]); - set.insert([0xc4,0xad,0x39,0x80,0xab,0x87,0x72,0xd4,0xd6,0x3b,0x0a,0x7f,0x51,0xba,0xdf,0x00,0x65,0xdc,0x09,0x5a]); - set.insert([0xc4,0xc1,0x07,0x66,0xc4,0x48,0x9b,0x71,0x77,0xcf,0x5a,0x21,0xa0,0xdc,0x48,0xe6,0x89,0x99,0x9a,0xe8]); - set.insert([0xc4,0xc2,0xef,0x79,0x5e,0x37,0x11,0x16,0xee,0xa7,0xfe,0x8b,0x98,0x1e,0x38,0xb7,0xe0,0xcf,0x10,0x17]); - set.insert([0xc6,0x45,0xec,0xce,0xbc,0x5a,0xa8,0x19,0x3b,0x4b,0xe8,0x5c,0x71,0xec,0x55,0x0f,0x6e,0x0b,0xf6,0xe9]); - set.insert([0xc6,0x65,0x51,0xe2,0xc5,0x57,0x6b,0x91,0xe2,0x95,0x4d,0xca,0x76,0x79,0xa9,0x26,0x65,0xf5,0x89,0x4c]); - set.insert([0xc8,0x63,0x8d,0xc5,0xe9,0x29,0x33,0x70,0x9f,0x64,0x7c,0xa7,0xab,0x78,0xee,0xb3,0x9d,0x39,0x95,0x75]); - set.insert([0xc9,0xb2,0x52,0x64,0x1d,0xfc,0xbd,0xf9,0x58,0x78,0xb1,0xcc,0x03,0x19,0x21,0x2c,0x74,0x1c,0xfe,0xad]); - set.insert([0xcb,0xfd,0xda,0x92,0x33,0x07,0xf8,0xab,0x91,0x89,0x71,0x31,0xb6,0x13,0xb7,0xd8,0xe7,0xd6,0x22,0xe2]); - set.insert([0xcd,0xd1,0x28,0x05,0x6d,0x8f,0x6b,0xb1,0xcb,0x31,0x17,0xf3,0x7f,0x0a,0xea,0xdc,0x1a,0x51,0xf2,0x9b]); - set.insert([0xce,0x8a,0x5c,0x63,0x01,0xb1,0x8a,0xac,0xde,0x48,0xff,0x4c,0x83,0x8b,0x59,0xe3,0x87,0x63,0xe6,0x05]); - set.insert([0xd0,0xc4,0x65,0x7e,0xb4,0x0a,0xdc,0x66,0x23,0x78,0xad,0x0b,0x6b,0x25,0x13,0xc6,0x13,0x8e,0xf5,0x51]); - set.insert([0xd2,0x9e,0x7c,0x5a,0x8b,0x1c,0xbd,0xf6,0x36,0x29,0xf0,0x86,0x28,0x93,0xa8,0xf8,0x90,0x77,0xb4,0x1a]); - set.insert([0xd4,0x1b,0x6b,0x7f,0xda,0x64,0xdc,0x1e,0x48,0x10,0xa7,0x79,0xf9,0x77,0x97,0xc0,0x5f,0xed,0x4e,0x80]); - set.insert([0xd7,0x54,0xcb,0xa1,0x3f,0xc2,0xe3,0x7b,0x0b,0x8f,0x92,0x10,0x65,0x21,0x45,0x0c,0x78,0x24,0xe8,0x5a]); - set.insert([0xd7,0xda,0x52,0x0c,0xcc,0x85,0xd5,0x6c,0x19,0x25,0x6f,0xe6,0x78,0x52,0xe8,0x7a,0x3d,0x09,0x9d,0xe6]); - set.insert([0xd9,0x14,0xc2,0xa4,0x9c,0xf1,0x94,0x85,0xef,0x47,0x28,0xe4,0x7c,0xeb,0x66,0x04,0x30,0x40,0xe0,0xff]); - set.insert([0xd9,0x63,0xe8,0x1a,0xcf,0x29,0x1c,0x7a,0xee,0xb5,0xfa,0x0f,0xf6,0x15,0x91,0xef,0xb8,0x6d,0x30,0xd2]); - set.insert([0xda,0xc4,0xc2,0x91,0x87,0x0c,0xbd,0x89,0x8a,0xf5,0x3e,0xcc,0x29,0x86,0x26,0x47,0x4b,0x9b,0x5e,0x9d]); - set.insert([0xdb,0x76,0x94,0xa4,0x75,0xe9,0xd6,0xaf,0x40,0x09,0xb6,0x0c,0x4b,0xe0,0xec,0x87,0xad,0x1a,0x6e,0xc6]); - set.insert([0xdd,0x14,0xdb,0x55,0xa2,0x49,0x43,0x8d,0x2e,0xc6,0xd1,0xbe,0x1f,0x7c,0x1d,0x57,0x96,0x6b,0x9a,0xe8]); - set.insert([0xdf,0x25,0xed,0x09,0xfc,0xa7,0x7a,0x19,0xd8,0x86,0xad,0x4f,0x2b,0xca,0x26,0x63,0xc0,0xa5,0xc1,0x13]); - set.insert([0xe0,0xae,0x16,0xc0,0x87,0x51,0x05,0xd0,0xde,0x9c,0xa5,0xfe,0x53,0xa9,0x4c,0x93,0xa4,0x01,0xc9,0xb1]); - set.insert([0xe0,0xd1,0x22,0xf6,0x11,0xe3,0x79,0x5b,0x28,0xa2,0x41,0x57,0xa9,0xc0,0x10,0x8b,0xca,0x57,0x92,0xf4]); - set.insert([0xe1,0x42,0xdf,0x5d,0x19,0x0e,0x4c,0x77,0xda,0x81,0xea,0xab,0x6c,0x81,0x88,0x6a,0x9a,0xd7,0x61,0x39]); - set.insert([0xe2,0x55,0x63,0x2d,0xa8,0xcb,0x96,0x8a,0x9b,0x8a,0x7c,0xcc,0xb6,0xcf,0x02,0x0c,0xce,0xca,0xfe,0x22]); - set.insert([0xe3,0x5a,0x36,0xf5,0xa1,0xee,0x2b,0xa8,0xfc,0x85,0x69,0x05,0x29,0x9c,0x84,0xf7,0x5b,0x61,0xe8,0x30]); - set.insert([0xe5,0x71,0x83,0xd0,0xf0,0x63,0x54,0x86,0x89,0xc5,0xa1,0x4d,0x3b,0x72,0xd8,0x77,0x12,0x14,0x41,0xf1]); - set.insert([0xe5,0x89,0xcf,0xb3,0xfc,0x64,0xc0,0xa6,0x9a,0x66,0xf3,0x13,0xcb,0xa7,0xd1,0x9e,0x8b,0x86,0xcf,0x46]); - set.insert([0xe6,0x80,0x2c,0xc0,0x7c,0xa9,0xdc,0xc9,0x1e,0xde,0xa1,0xd5,0xa8,0x8a,0x59,0xa2,0x01,0x09,0x06,0x11]); - set.insert([0xe8,0xbf,0x93,0x90,0xba,0x54,0xcd,0x80,0x00,0x13,0x08,0xc6,0xe2,0x57,0xac,0x77,0xd0,0x3c,0x61,0x8c]); - set.insert([0xed,0xbb,0x72,0x73,0xc0,0x23,0x8a,0x72,0xf8,0x91,0xb6,0x75,0xb6,0x87,0x5f,0xa8,0xe6,0x6e,0x09,0x9c]); - set.insert([0xed,0xbe,0x8c,0xf5,0x9a,0x64,0x2b,0xac,0xd1,0x89,0xe4,0xe0,0x05,0x62,0xdf,0xab,0xae,0xfd,0x11,0x20]); - set.insert([0xed,0xe9,0x0d,0xdf,0xdc,0x82,0xcb,0x63,0xea,0x76,0xf7,0x15,0x89,0x96,0x63,0xd2,0x89,0xf4,0x51,0xe4]); - set.insert([0xee,0x90,0xd9,0x8f,0x77,0x3e,0xf0,0x92,0x04,0x86,0x3f,0xb6,0xf2,0xaf,0x33,0x5d,0x33,0x93,0x2f,0xbd]); - set.insert([0xf0,0x2c,0x4e,0xef,0x50,0xb2,0xb4,0x66,0x0d,0x29,0x1c,0x81,0x36,0xa8,0x46,0x34,0x2f,0x79,0x0b,0x9d]); - set.insert([0xf2,0x28,0xe8,0xbb,0x0a,0xea,0x2e,0x37,0x06,0x6f,0x93,0xdb,0x5c,0xbf,0xd9,0x34,0x2d,0x8f,0xff,0x0d]); - set.insert([0xf3,0xdc,0x48,0x8e,0xa5,0xf4,0x11,0x56,0xd4,0x97,0xcf,0x0f,0xec,0x05,0x44,0x9d,0x18,0xaa,0x2a,0x49]); - set.insert([0xf4,0xe1,0x2f,0x72,0xac,0xcd,0xc8,0x3e,0xa3,0xe1,0x6b,0x73,0x07,0x79,0x69,0x0b,0x4a,0x9e,0x0b,0xed]); - set.insert([0xf8,0xe6,0x1a,0x4a,0x80,0xc7,0x70,0x28,0xbe,0xb3,0x3a,0xe4,0xc4,0x6e,0x69,0xe6,0xf4,0x90,0x4e,0x61]); - set.insert([0xf9,0x63,0xa2,0xbd,0x05,0x71,0x6c,0x42,0x9d,0x66,0x64,0x7b,0x6e,0xf1,0x53,0x87,0x47,0xcc,0xe5,0x5c]); - set.insert([0xfb,0xeb,0x13,0x69,0x09,0x16,0x3a,0x11,0x5f,0x42,0x3e,0xf4,0xc3,0x5d,0x4c,0xdc,0xcc,0xfe,0x33,0x6d]); - set.insert([0xfc,0x2c,0x11,0xc9,0x5a,0x5a,0xad,0xfd,0x35,0x00,0x89,0x1e,0xce,0x06,0x65,0x1c,0x0b,0x4e,0xe0,0xe5]); - set.insert([0xfe,0xc9,0x34,0x2e,0x9e,0xe4,0x18,0x64,0x53,0xf8,0xa7,0xe0,0x27,0xfa,0xc8,0xc2,0x4e,0x7c,0x0c,0x60]); - set.insert([0xff,0xf4,0xfe,0x67,0xc5,0x2b,0x8d,0x0d,0x42,0x5d,0x2b,0x97,0x72,0xe7,0xa4,0xff,0xcd,0x9d,0xac,0xf3]); + macro_rules! add_machine { + ($set:expr, $hex:literal) => { + $set.insert(hex_literal::hex!($hex)); + }; + } + + add_machine!(set, "01507c957789b7c1afde972d67f1fdd53af1a8da"); + add_machine!(set, "03372b2a39e0713c965a0876b5e807b41d509538"); + add_machine!(set, "04f01407b762af16db04ac648aee5feb24cf6eb8"); + add_machine!(set, "050430408a4ceae5d0b9d95721d651222cbd83d3"); + add_machine!(set, "051f83eb42dfdd7850086cf5696fbb3653f883ae"); + add_machine!(set, "09e9875ed7acd42c7dd19d72a39524f6ae3e87fa"); + add_machine!(set, "1121e6d9a770c9e562ae423012080e52765ecf71"); + add_machine!(set, "13f108bdf8fd3f11e75026d98ed1803075257354"); + add_machine!(set, "14d1236033fde31e0bcd570c3291eaa9bdb7e25e"); + add_machine!(set, "1632ea13051cc4d392cb8d3e016eb5617d8e8b2a"); + add_machine!(set, "188120cd27f658a7292c466f6c7df5af6cdb966e"); + add_machine!(set, "1a2425c4955555f0ea8c0315e116e0135f3a04c9"); + add_machine!(set, "1ae4fb51626d0d274c0bd3851e5a04dee0b0d53b"); + add_machine!(set, "1b3aade441add658f9f95c10ce0f3d754f92a327"); + add_machine!(set, "1c8be811c09185a9f6c7dc3fba81e878a58d0a1b"); + add_machine!(set, "20598fcb4ba579c5a09e8c1a42ec9c0210cb43f3"); + add_machine!(set, "2087688522965eb04c9ae9f33ea94bbf820878f1"); + add_machine!(set, "211f0f5570f7aabfe6a8b7cf77dec8d33dd5feea"); + add_machine!(set, "21cae822314c17721677c41cd8423464983553c1"); + add_machine!(set, "221cd8234e369ef19dfdad94f437d3a190cb2673"); + add_machine!(set, "2491b9a22f4b3d4582af20921919bc2771c80fde"); + add_machine!(set, "26671a0931ebde25273736bf6b4b2ed1038c4443"); + add_machine!(set, "28049f3f69f6558324e52d44ecdef897b1a3b390"); + add_machine!(set, "2854e3e3894986168e90ce3a017bfecf65ce7911"); + add_machine!(set, "29f3c41bbf0dbd38fd4b052d27ca6486a906688d"); + add_machine!(set, "2a003f2b908b08476be25d011c57fe11fc6892f9"); + add_machine!(set, "307bbcfb24abdb94a6b7cabaddb919046403ffe6"); + add_machine!(set, "315db04df669894a3e35429691b8b350d8cbcde2"); + add_machine!(set, "32ea0bc90831a8fb988c208e5328ac7b64eb298d"); + add_machine!(set, "346df4cce9f27b23c5f0823ee9d260c166fed3db"); + add_machine!(set, "3599c48a2a1bbff874dac46d986a512f69fbc8d0"); + add_machine!(set, "36a37506dcc62a2153ae3da741f56a01bed54267"); + add_machine!(set, "3e6830d6a2d839bf36bb108ca8ccc25a1678f82f"); + add_machine!(set, "40832a64b27c12c7abe6be0947163ee483478c61"); + add_machine!(set, "4101a8187d20889c4fd247b4c8279b66318ef091"); + add_machine!(set, "4226d078029b9be4f32a615e9290dbcde3d55f76"); + add_machine!(set, "443b01f07719d7ce6cbde861082a33181bb24e4c"); + add_machine!(set, "44e10597b42e571423915385fe85ced0e840850c"); + add_machine!(set, "461be5de74ce833d3828fcb57c243b6015d76d7f"); + add_machine!(set, "488228894e7265ff74d97495d2d536b9c7f57411"); + add_machine!(set, "4af5d94e2281e2a4c23ed84c4a05aa5e7a3178d2"); + add_machine!(set, "4e09788159008f91d7f3d68b1af2355b3c1772cc"); + add_machine!(set, "4ff7e9724d98c50d6118f65f3004a1fccded1ad8"); + add_machine!(set, "500f6449b97e2be1e68f0cb1ed59dee3c8e6d9c0"); + add_machine!(set, "51c1ede18e73fc7e00e8fc018ede53632f8bb6d9"); + add_machine!(set, "53543f1a7d08c13d69385b8120562a76b871f8ec"); + add_machine!(set, "57198eb36e5c996863b626eb6f23e3877cb2ed17"); + add_machine!(set, "57a6877d0e96ce77a3fafb0c2f7e9ed9e28fb037"); + add_machine!(set, "5af0f73c1e99f55f27d022400f5c4b9216593532"); + add_machine!(set, "5d73a589b357f4e7ad599b4a4a7e4338cd733018"); + add_machine!(set, "608a11e7ce88e1abd1c54a3566cc7b6332be05b5"); + add_machine!(set, "61897d0310110214035bcbad0f7a46ff447ec0e7"); + add_machine!(set, "674497918b4204d3e686ba23408a9aa216b2227a"); + add_machine!(set, "68928aa2c3167d75d566e54b475462aa2872cb2f"); + add_machine!(set, "6925e66c41bb7e7f5ec3808f7ae7a05c419fecc4"); + add_machine!(set, "6a81ac2a32cc2eac4b974b1819ed2b7568c83c04"); + add_machine!(set, "6ce72aa22018622c24a2c0aac45f14617aec59e5"); + add_machine!(set, "70b931353e3925bbf3dd70046f32911c9761fca6"); + add_machine!(set, "7402b63c09f3520931dac2f9f702ce16503d3648"); + add_machine!(set, "782770253c0ae72edd91138ad0017cdb9a7d8dba"); + add_machine!(set, "791773aa0b8ae2dc8cb75eb9d564a0d598125572"); + add_machine!(set, "7a89c9dd7383dde27419b36e2c6d0d942eee85d9"); + add_machine!(set, "7d0af9bbd94bc0cca22684e86ac62b58e5134223"); + add_machine!(set, "7f1c6994729637e3fd4cc2f5faaeb9bffb17c1a2"); + add_machine!(set, "803bcee8a47247aa762a29d9ed59d63defc5f861"); + add_machine!(set, "80fcb4f6f086e6bbd832500c2b729c26b3bf1ad2"); + add_machine!(set, "813bf820fd5435d03db7bbeb04d2c34217f2f949"); + add_machine!(set, "84ca012846315415126521d8afdf5dda5f775306"); + add_machine!(set, "8796f516e23e15624e50e6d34a3ab4d812fdca7e"); + add_machine!(set, "8f06c7f4f5f86842aee784337021ebd59d4af9f1"); + add_machine!(set, "8fc9821dbfa83b217f8f61f1f41f057425dcd3b6"); + add_machine!(set, "8ffbc5ef59ef9f2289e74a3745039d900fba30fe"); + add_machine!(set, "9048c142de1fe70d3ef4a9107ccfbe235df536c0"); + add_machine!(set, "92166c988e5e02184bf2d5b3b97a1e76bd6112fe"); + add_machine!(set, "93bd0a2c4b01d3fb0f21b072c04feeea7e649ae2"); + add_machine!(set, "97587e418dc1afbca9939c06ccb97f3115c58c65"); + add_machine!(set, "98cb371d43682eb87d6fb1ac1c9589d79fcd69ce"); + add_machine!(set, "9ace47eacbe6ab5112bd6d8ebc555b0fef9f2332"); + add_machine!(set, "9c80bc6bf4586edb2689c3093a9a0aeca3014805"); + add_machine!(set, "9d08171ec1cae6ce1ea0ce3f3674fa5d01f6f1b3"); + add_machine!(set, "9d3f1160d215e9438a601c8771a972bcebe097f0"); + add_machine!(set, "9e8320462733ed8a124fc97d7fdf33840b6e3a2c"); + add_machine!(set, "9ebd6f9e550f0d6dd00de5255f03ded61e17e2c7"); + add_machine!(set, "a02f25afce5eeab321a4e76943e56d6e9aa73fe4"); + add_machine!(set, "a0417d627d225e21543cf9a91b2d83b95f091dc6"); + add_machine!(set, "a40b9476fb305c1d39752fd48548c5fa3c371571"); + add_machine!(set, "a46849552c7363285baedb5a6b6814809a59ed92"); + add_machine!(set, "a6adabb2a25d233c62afd1fc0e991d2513dc11d4"); + add_machine!(set, "ac47f3115109baeb98deafdcbd980117b4e286ba"); + add_machine!(set, "af1578fbef76672fef3b9250b30cef407e78fd26"); + add_machine!(set, "b2ed08994ae4d6db46b316d384380f69636404fa"); + add_machine!(set, "b2fbe8a9d6b17f9af5110ab556d8b144bc74964d"); + add_machine!(set, "b3c0a1406894e931961e0fe34a68bd0148337e58"); + add_machine!(set, "b4cdc2e6620dfd8c5d565041284714c38079c74c"); + add_machine!(set, "b7ed7f4a1288c98c49b46a6af856532e65eaedab"); + add_machine!(set, "bb98127d89b2e3f4f9db410b060e0affa48e07ef"); + add_machine!(set, "bbed9ac0c3b9203d4da19cab34fbfb8ce6a4411c"); + add_machine!(set, "bd55e813db245b64f2269fc767ee1db10ad9df94"); + add_machine!(set, "bf101c4de90cdc2e66744438391f60cea977c9cc"); + add_machine!(set, "c133f0c3751a908584dcdf322d72b5177c12e732"); + add_machine!(set, "c2f7f3b60acde8ddff167104c56e1ed5a1e3eb74"); + add_machine!(set, "c3108fa405ef44a71a5d880321e09a620f7f4f76"); + add_machine!(set, "c31a7d5c5080d90a620d364854ba336dc82cb2c1"); + add_machine!(set, "c4ad3980ab8772d4d63b0a7f51badf0065dc095a"); + add_machine!(set, "c4c10766c4489b7177cf5a21a0dc48e689999ae8"); + add_machine!(set, "c4c2ef795e371116eea7fe8b981e38b7e0cf1017"); + add_machine!(set, "c645eccebc5aa8193b4be85c71ec550f6e0bf6e9"); + add_machine!(set, "c66551e2c5576b91e2954dca7679a92665f5894c"); + add_machine!(set, "c8638dc5e92933709f647ca7ab78eeb39d399575"); + add_machine!(set, "c9b252641dfcbdf95878b1cc0319212c741cfead"); + add_machine!(set, "cbfdda923307f8ab91897131b613b7d8e7d622e2"); + add_machine!(set, "cdd128056d8f6bb1cb3117f37f0aeadc1a51f29b"); + add_machine!(set, "ce8a5c6301b18aacde48ff4c838b59e38763e605"); + add_machine!(set, "d0c4657eb40adc662378ad0b6b2513c6138ef551"); + add_machine!(set, "d29e7c5a8b1cbdf63629f0862893a8f89077b41a"); + add_machine!(set, "d41b6b7fda64dc1e4810a779f97797c05fed4e80"); + add_machine!(set, "d754cba13fc2e37b0b8f92106521450c7824e85a"); + add_machine!(set, "d7da520ccc85d56c19256fe67852e87a3d099de6"); + add_machine!(set, "d914c2a49cf19485ef4728e47ceb66043040e0ff"); + add_machine!(set, "d963e81acf291c7aeeb5fa0ff61591efb86d30d2"); + add_machine!(set, "dac4c291870cbd898af53ecc298626474b9b5e9d"); + add_machine!(set, "db7694a475e9d6af4009b60c4be0ec87ad1a6ec6"); + add_machine!(set, "dd14db55a249438d2ec6d1be1f7c1d57966b9ae8"); + add_machine!(set, "df25ed09fca77a19d886ad4f2bca2663c0a5c113"); + add_machine!(set, "e0ae16c0875105d0de9ca5fe53a94c93a401c9b1"); + add_machine!(set, "e0d122f611e3795b28a24157a9c0108bca5792f4"); + add_machine!(set, "e142df5d190e4c77da81eaab6c81886a9ad76139"); + add_machine!(set, "e255632da8cb968a9b8a7cccb6cf020ccecafe22"); + add_machine!(set, "e35a36f5a1ee2ba8fc856905299c84f75b61e830"); + add_machine!(set, "e57183d0f063548689c5a14d3b72d877121441f1"); + add_machine!(set, "e589cfb3fc64c0a69a66f313cba7d19e8b86cf46"); + add_machine!(set, "e6802cc07ca9dcc91edea1d5a88a59a201090611"); + add_machine!(set, "e8bf9390ba54cd80001308c6e257ac77d03c618c"); + add_machine!(set, "edbb7273c0238a72f891b675b6875fa8e66e099c"); + add_machine!(set, "edbe8cf59a642bacd189e4e00562dfabaefd1120"); + add_machine!(set, "ede90ddfdc82cb63ea76f715899663d289f451e4"); + add_machine!(set, "ee90d98f773ef09204863fb6f2af335d33932fbd"); + add_machine!(set, "f02c4eef50b2b4660d291c8136a846342f790b9d"); + add_machine!(set, "f228e8bb0aea2e37066f93db5cbfd9342d8fff0d"); + add_machine!(set, "f3dc488ea5f41156d497cf0fec05449d18aa2a49"); + add_machine!(set, "f4e12f72accdc83ea3e16b730779690b4a9e0bed"); + add_machine!(set, "f8e61a4a80c77028beb33ae4c46e69e6f4904e61"); + add_machine!(set, "f963a2bd05716c429d66647b6ef1538747cce55c"); + add_machine!(set, "fbeb136909163a115f423ef4c35d4cdcccfe336d"); + add_machine!(set, "fc2c11c95a5aadfd3500891ece06651c0b4ee0e5"); + add_machine!(set, "fec9342e9ee4186453f8a7e027fac8c24e7c0c60"); + add_machine!(set, "fff4fe67c52b8d0d425d2b9772e7a4ffcd9dacf3"); let mut ret = allow_list::Data { m_to_o: HashMap::new(), From 2c4b88b0693db0b115d6a88b9e2d0db3ef3711e2 Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 9 Apr 2026 14:48:32 +0000 Subject: [PATCH 20/55] machine_swap: must provide older machine, simplified impl --- cosmwasm/enclaves/execute/Enclave.edl | 2 +- .../execute/src/registration/attestation.rs | 135 ++++++++---------- .../execute/src/registration/offchain.rs | 15 +- .../execute/src/registration/onchain.rs | 40 ++---- cosmwasm/packages/sgx-vm/src/attestation.rs | 10 +- x/registration/internal/keeper/keeper.go | 8 +- 6 files changed, 83 insertions(+), 127 deletions(-) diff --git a/cosmwasm/enclaves/execute/Enclave.edl b/cosmwasm/enclaves/execute/Enclave.edl index 81415c68cf..ef7d704a63 100644 --- a/cosmwasm/enclaves/execute/Enclave.edl +++ b/cosmwasm/enclaves/execute/Enclave.edl @@ -75,7 +75,7 @@ enclave { uintptr_t n_seeds, [out] uintptr_t* p_seeds_size, [in, count=20] const uint8_t* p_machine_pop, - [out, count=104] uint8_t* p_machine_del_add + [out, count=52] uint8_t* p_machine_info ); public NodeAuthResult ecall_check_patch_level( diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index 24ece2b1a0..57c87207cd 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -108,9 +108,9 @@ impl KnownJwtKeys { pub mod allow_list { - use std::collections::HashMap; - use enclave_utils::KEY_MANAGER; + use log::*; + use std::collections::HashMap; use crate::registration::attestation::SELF_MACHINE_ID; @@ -122,35 +122,23 @@ pub mod allow_list { pub struct Data { pub m_to_o: HashMap, - pub o_to_m: HashMap>, } impl Data { - fn update_o_to_m(&mut self, owner: &Owner, machine: &MachineID, add: bool) { - if *owner == [0u8; OWNER_LEN] { - return; - } - - let should_remove = { - let owned_machines = self.o_to_m.entry(*owner).or_default(); - - if add { - owned_machines.push(*machine); - } else { - if let Some(pos) = owned_machines.iter().position(|x| x == machine) { - owned_machines.remove(pos); - } - } - - owned_machines.is_empty() - }; + fn log_machine_change(machine: &MachineID, owner: &Owner) { + println!( + "machine {} owner set to {}", + hex::encode(machine), + hex::encode(owner) + ); + } - if should_remove { - self.o_to_m.remove(owner); + fn on_machine_changed(machine: &MachineID, added: bool, silent: bool) { + if !silent { + let action = if added { "added" } else { "deleted" }; + println!("machine {} {}", hex::encode(machine), action); } - } - fn on_machine_changed(&mut self, machine: &MachineID, added: bool) { if let Some(my_machine) = SELF_MACHINE_ID.as_ref() { if my_machine == machine { println!("Self machine included: {}", added); @@ -166,57 +154,57 @@ pub mod allow_list { machine: &MachineID, owner: &Owner, machine_pop: &MachineID, - ) -> Option<(MachineID, Owner)> { - let prev_owner_opt = if let Some(prev_owner_ref) = self.m_to_o.get_mut(machine) { - let prev_owner_val = *prev_owner_ref; - *prev_owner_ref = *owner; // update existing machine - - Some(prev_owner_val) - } else { - None - }; + ) -> bool { + let is_same_machine = + (*machine_pop == [0u8; MACHINE_ID_LEN]) || (*machine_pop == *machine); + if is_same_machine { + let x = match self.m_to_o.get_mut(machine) { + Some(x) => x, + None => { + error!("unknown machine {}", hex::encode(machine)); + return false; + } + }; - if let Some(prev_owner) = prev_owner_opt { - self.update_o_to_m(&prev_owner, machine, false); // remove machine from prev owner - self.update_o_to_m(owner, machine, true); // insert machine to new owner + if x == owner { + return false; // no error, just no effect + } - Some((*machine, prev_owner)) + *x = *owner; // replace the owner of } else { - // machine is new. Remove this owner's old machine - let old_machine = { - let owned_machines = match self.o_to_m.get_mut(owner) { - Some(x) => x, - None => { - return None; // no old machines - } - }; - - // select the machine to remove. Either the specified, OR the first in the array - let pos = owned_machines - .iter() - .position(|x| x == machine_pop) - .unwrap_or(0); - - let old_machine = owned_machines[pos]; - owned_machines[pos] = *machine; // update the owner machine + if let Some(x) = self.m_to_o.get(machine_pop) { + if *x != *owner { + error!( + "unknown machine {} not owned by this actor", + hex::encode(machine_pop) + ); + return false; + } + } else { + error!("unknown machine {}", hex::encode(machine_pop)); + return false; + } - old_machine - }; + if self.m_to_o.contains_key(machine) { + error!("machine {} already exists", hex::encode(machine)); + return false; + } - self.m_to_o.remove(&old_machine); + self.m_to_o.remove(machine_pop); self.m_to_o.insert(*machine, *owner); - self.on_machine_changed(&old_machine, false); - self.on_machine_changed(machine, true); - - Some((old_machine, *owner)) + Self::on_machine_changed(machine_pop, false, false); + Self::on_machine_changed(machine, true, false); } + + Self::log_machine_change(machine, owner); + true } - pub fn add_new(&mut self, machine: MachineID) -> bool { + pub fn add_new(&mut self, machine: MachineID, silent: bool) -> bool { if let std::collections::hash_map::Entry::Vacant(e) = self.m_to_o.entry(machine) { e.insert([0u8; OWNER_LEN]); - self.on_machine_changed(&machine, true); + Self::on_machine_changed(&machine, true, silent); true } else { false @@ -260,14 +248,16 @@ lazy_static::lazy_static! { }; pub static ref PPID_WHITELIST: SgxMutex = { - let mut set: HashSet<[u8; 20]> = HashSet::new(); - macro_rules! add_machine { ($set:expr, $hex:literal) => { - $set.insert(hex_literal::hex!($hex)); + $set.add_new(hex_literal::hex!($hex), true); }; } + let mut set = allow_list::Data { + m_to_o: HashMap::new(), + }; + add_machine!(set, "01507c957789b7c1afde972d67f1fdd53af1a8da"); add_machine!(set, "03372b2a39e0713c965a0876b5e807b41d509538"); add_machine!(set, "04f01407b762af16db04ac648aee5feb24cf6eb8"); @@ -416,16 +406,7 @@ lazy_static::lazy_static! { add_machine!(set, "fec9342e9ee4186453f8a7e027fac8c24e7c0c60"); add_machine!(set, "fff4fe67c52b8d0d425d2b9772e7a4ffcd9dacf3"); - let mut ret = allow_list::Data { - m_to_o: HashMap::new(), - o_to_m: HashMap::new(), - }; - - for x in set { - ret.add_new(x); - } - - SgxMutex::new(ret) + SgxMutex::new(set) }; static ref FMSPC_EOL: HashSet<&'static str> = HashSet::from([ diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index a4eb9a6e6c..f053fd9157 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -867,9 +867,7 @@ pub unsafe extern "C" fn ecall_onchain_approve_machine_id( let machine_id: &allow_list::MachineID = machine_id.try_into().unwrap(); - if allow_list.add_new(*machine_id) { - println!("Onchain added machine ID: {}", hex::encode(machine_id)); - } + allow_list.add_new(*machine_id, false); } sgx_types::sgx_status_t::SGX_SUCCESS @@ -1069,16 +1067,9 @@ pub unsafe extern "C" fn ecall_submit_machine_swap( let mut allow_list = PPID_WHITELIST.lock().unwrap(); if let Some(swap_info) = swap_info_opt { - if allow_list - .update(machine_id, swap_info.0, swap_info.1) - .is_some() - { - println!("cold updated machine ID: {}", hex::encode(machine_id)); - } + allow_list.update(machine_id, swap_info.0, swap_info.1); } else { - if allow_list.add_new(*machine_id) { - println!("cold added machine ID: {}", hex::encode(machine_id)); - } + allow_list.add_new(*machine_id, false); } } diff --git a/cosmwasm/enclaves/execute/src/registration/onchain.rs b/cosmwasm/enclaves/execute/src/registration/onchain.rs index 43c21a1130..f641071487 100644 --- a/cosmwasm/enclaves/execute/src/registration/onchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/onchain.rs @@ -73,20 +73,6 @@ fn verify_attestation_dcap( Ok(res) } -unsafe fn copy_machine_data_res( - p_machine_data: *mut u8, - machine: &allow_list::MachineID, - owner: &allow_list::Owner, -) { - slice::from_raw_parts_mut(p_machine_data, allow_list::OWNER_LEN).copy_from_slice(owner); - - slice::from_raw_parts_mut( - p_machine_data.add(allow_list::OWNER_LEN), - allow_list::MACHINE_ID_LEN, - ) - .copy_from_slice(machine); -} - /// /// `ecall_authenticate_new_node` /// @@ -109,15 +95,13 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( n_seeds: u32, p_seeds_size: *mut u32, p_machine_pop: *const u8, - p_machine_del_add: *mut u8, + p_machine_info: *mut u8, ) -> NodeAuthResult { if let Err(_err) = oom_handler::register_oom_handler() { error!("Could not register OOM handler!"); return NodeAuthResult::MemorySafetyAllocationError; } - const MACHINE_INFO_LEN: usize = allow_list::OWNER_LEN + allow_list::MACHINE_ID_LEN; - validate_mut_ptr!(p_seeds, n_seeds as usize, NodeAuthResult::InvalidInput); validate_const_ptr!( p_machine_pop, @@ -125,8 +109,8 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( NodeAuthResult::InvalidInput ); validate_mut_ptr!( - p_machine_del_add, - MACHINE_INFO_LEN * 2, + p_machine_info, + allow_list::OWNER_LEN + allow_list::MACHINE_ID_LEN, NodeAuthResult::InvalidInput ); validate_const_ptr!(cert, cert_len as usize, NodeAuthResult::InvalidInput); @@ -203,15 +187,15 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( .unwrap(); // if swap-res failed - never mind. This is probably because the machine was added with proof-of-cloud - if let Some(swap_res) = allow_list.update(&machine_id_hash, owner, machine_pop) - { - copy_machine_data_res( - p_machine_del_add.add(MACHINE_INFO_LEN), - &machine_id_hash, - owner, - ); - - copy_machine_data_res(p_machine_del_add, &swap_res.0, &swap_res.1); + if allow_list.update(&machine_id_hash, owner, machine_pop) { + slice::from_raw_parts_mut(p_machine_info, allow_list::OWNER_LEN) + .copy_from_slice(owner); + + slice::from_raw_parts_mut( + p_machine_info.add(allow_list::OWNER_LEN), + allow_list::MACHINE_ID_LEN, + ) + .copy_from_slice(&machine_id_hash); } } diff --git a/cosmwasm/packages/sgx-vm/src/attestation.rs b/cosmwasm/packages/sgx-vm/src/attestation.rs index 8f5fa1b3d8..2742da0077 100644 --- a/cosmwasm/packages/sgx-vm/src/attestation.rs +++ b/cosmwasm/packages/sgx-vm/src/attestation.rs @@ -23,7 +23,7 @@ extern "C" { n_seeds: u32, p_seeds_size: *mut u32, p_machine_pop: *const u8, - p_machine_del_add: *mut u8, + machine_info: *mut u8, ) -> sgx_status_t; pub fn ecall_get_genesis_seed( eid: sgx_enclave_id_t, @@ -74,7 +74,7 @@ pub fn untrusted_get_encrypted_seed( seed_buffer.resize(SINGLE_ENCRYPTED_SEED_SIZE * 100, 0); // should be enough. Resize in later version, when approaching the limit let mut seeds_size: u32 = 0; - let mut machine_add_del = [0_u8; 104]; + let mut machine_info = [0_u8; 52]; let status = unsafe { ecall_authenticate_new_node( @@ -86,7 +86,7 @@ pub fn untrusted_get_encrypted_seed( seed_buffer.len() as u32, &mut seeds_size, replace_machine.as_ptr(), - machine_add_del.as_mut_ptr(), + machine_info.as_mut_ptr(), ) }; @@ -108,11 +108,11 @@ pub fn untrusted_get_encrypted_seed( seed_buffer.resize(seeds_size as usize, 0); debug!("Done auth, got seed: {}", hex::encode(&seed_buffer)); - let is_machine_data_zero = machine_add_del.iter().all(|&x| x == 0); + let is_machine_data_zero = machine_info.iter().all(|&x| x == 0); let machine_data_arr = if is_machine_data_zero { Vec::new() } else { - machine_add_del.to_vec() + machine_info.to_vec() }; Ok(Ok((seed_buffer, machine_data_arr))) diff --git a/x/registration/internal/keeper/keeper.go b/x/registration/internal/keeper/keeper.go index 845421554e..abeed81678 100644 --- a/x/registration/internal/keeper/keeper.go +++ b/x/registration/internal/keeper/keeper.go @@ -359,17 +359,17 @@ func (k Keeper) RegisterNode(ctx sdk.Context, certificate ra.Certificate, replac } } - var machineSwapInfo []byte - encSeed, machineSwapInfo, err = k.enclave.GetEncryptedSeed(certificate, replaceMachineID[:]) + var machineInfo []byte + encSeed, machineInfo, err = k.enclave.GetEncryptedSeed(certificate, replaceMachineID[:]) if err != nil { // return 0, errorsmod.Wrap(err, "cosmwasm create") return nil, errorsmod.Wrap(types.ErrAuthenticateFailed, err.Error()) } - if len(machineSwapInfo) == 104 { + if len(machineInfo) == 52 { store_swap_info := make([]byte, 72) - copy(store_swap_info[:52], machineSwapInfo[52:52+52]) + copy(store_swap_info[:52], machineInfo[:]) copy(store_swap_info[52:72], replaceMachineID[:]) // last 20 bytes are the machine_id_pop - will be added later From 5e10210de399b7b805f2724babf5691dd2acdfd9 Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 9 Apr 2026 15:32:00 +0000 Subject: [PATCH 21/55] tx register: option to specify prev machine_id --- x/registration/client/cli/tx.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/x/registration/client/cli/tx.go b/x/registration/client/cli/tx.go index 3ba2a7f194..643f1e939d 100644 --- a/x/registration/client/cli/tx.go +++ b/x/registration/client/cli/tx.go @@ -29,9 +29,9 @@ func GetTxCmd() *cobra.Command { // AuthenticateNodeCmd will upload code to be reused. func AuthenticateNodeCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "auth [cert file]", + Use: "auth attestation_file [replace_machine_id]", Short: "Upload a certificate to authenticate the node", - Args: cobra.ExactArgs(1), + Args: cobra.RangeArgs(1, 2), RunE: func(cmd *cobra.Command, args []string) error { // clientCtx := client.GetClientContextFromCmd(cmd) clientCtx, err := client.GetClientTxContext(cmd) @@ -44,10 +44,17 @@ func AuthenticateNodeCmd() *cobra.Command { return err } + replace_machine_id := "" + + if len(args) > 1 { + replace_machine_id = args[1] + } + // build and sign the transaction, then broadcast to Tendermint msg := types.RaAuthenticate{ - Sender: clientCtx.GetFromAddress(), - Certificate: cert, + Sender: clientCtx.GetFromAddress(), + Certificate: cert, + ReplaceMachineId: replace_machine_id, } err = msg.ValidateBasic() if err != nil { From c2602889722b98a03ff4c4d48fb6d7ec712eb6cc Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 11 May 2026 10:24:42 +0000 Subject: [PATCH 22/55] added proof-of-cloud jwt token support --- .../execute/src/registration/attestation.rs | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index 57c87207cd..cb3e4e9805 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -730,15 +730,14 @@ impl AttestationCombined { let kid_bytes = base64::decode(kid_str)?; //println!("Kid {}", hex::encode(&kid_bytes)); - let known_keys = &KNOWN_JWT_KEYS; + // 3️⃣ Prepare the signed message (header + '.' + claims) + let mut message = Vec::new(); + message.extend_from_slice(header_b64.as_bytes()); + message.push(b'.'); + message.extend_from_slice(claims_b64.as_bytes()); + let known_keys = &KNOWN_JWT_KEYS; if let Some(verifying_key) = known_keys.coll.get(&kid_bytes) { - // 3️⃣ Prepare the signed message (header + '.' + claims) - let mut message = Vec::new(); - message.extend_from_slice(header_b64.as_bytes()); - message.push(b'.'); - message.extend_from_slice(claims_b64.as_bytes()); - let signature = rsa::pkcs1v15::Signature::try_from(signature_bytes.as_slice()) .map_err(|e| format!("invalid signature: {e}"))?; @@ -747,7 +746,20 @@ impl AttestationCombined { .verify(&message, &signature) .map_err(|_| "invalid signature")?; } else { - return Err(format!("Unknown kid: {}", kid_str).into()); + let poc_key = hex_literal::hex!( + "5ea69fede5bcf71054395b273bad67f67158c242d77945d436374020ece525cb" + ); + if kid_bytes == poc_key { + let pubkey = ed25519_dalek::PublicKey::from_bytes(&poc_key) + .map_err(|e| format!("invalid POC key: {e}"))?; + let sig = ed25519_dalek::Signature::from_bytes(signature_bytes.as_slice()) + .map_err(|e| format!("invalid POC sig: {e}"))?; + pubkey + .verify_strict(&message, &sig) + .map_err(|e| format!("invalid POC sig: {e}"))?; + } else { + return Err(format!("Unknown kid: {}", kid_str).into()); + } } Ok(claims_json) From ccb259f0ddc10187ec1b03c2a33596f3f273d485 Mon Sep 17 00:00:00 2001 From: cboh4 Date: Thu, 27 Nov 2025 15:31:04 +0200 Subject: [PATCH 23/55] write ecalls data to the db --- Makefile | 3 + app/app.go | 18 +- app/keepers/keepers.go | 11 + app/upgrades/v1.23.3/upgrade.go | 39 + cmd/secretd/root.go | 8 +- go-cosmwasm/api/callbacks.go | 12 +- go-cosmwasm/api/callbacks_cgo.go | 4 +- go-cosmwasm/api/callbacks_mock.go | 1 + go-cosmwasm/api/callbacks_nosgx.go | 34 + go-cosmwasm/api/ecall_client.go | 643 ++ go-cosmwasm/api/ecall_client_stub.go | 25 + go-cosmwasm/api/ecall_record.go | 916 ++ go-cosmwasm/api/ecall_record_stub.go | 145 + go-cosmwasm/api/lib.go | 524 +- go-cosmwasm/api/lib_nosgx.go | 425 + go-cosmwasm/api/link_muslc.go | 4 +- go-cosmwasm/api/link_std.go | 4 +- go-cosmwasm/api/link_std_sw.go | 4 +- go-cosmwasm/api/logger.go | 92 + go-cosmwasm/api/memory.go | 6 +- go-cosmwasm/api/recording_store.go | 130 + go-cosmwasm/api/recording_store_stub.go | 28 + go-cosmwasm/api/replay.go | 104 + go-cosmwasm/lib.go | 6 +- go.mod | 7 +- go.sum | 8 +- proto/secret/compute/v1beta1/query.proto | 188 + x/compute/internal/keeper/keeper.go | 180 +- x/compute/internal/keeper/msg_dispatcher.go | 67 +- x/compute/internal/keeper/msg_server.go | 2 +- x/compute/internal/keeper/querier.go | 293 + .../internal/keeper/recording_multistore.go | 232 + x/compute/internal/keeper/relay.go | 36 +- x/compute/internal/types/query.pb.go | 9197 +++++++++++++---- x/compute/internal/types/query.pb.gw.go | 789 +- x/compute/internal/types/types.go | 16 + x/compute/module.go | 76 +- 37 files changed, 11840 insertions(+), 2437 deletions(-) create mode 100644 app/upgrades/v1.23.3/upgrade.go create mode 100644 go-cosmwasm/api/callbacks_nosgx.go create mode 100644 go-cosmwasm/api/ecall_client.go create mode 100644 go-cosmwasm/api/ecall_client_stub.go create mode 100644 go-cosmwasm/api/ecall_record.go create mode 100644 go-cosmwasm/api/ecall_record_stub.go create mode 100644 go-cosmwasm/api/lib_nosgx.go create mode 100644 go-cosmwasm/api/logger.go create mode 100644 go-cosmwasm/api/recording_store.go create mode 100644 go-cosmwasm/api/recording_store_stub.go create mode 100644 go-cosmwasm/api/replay.go create mode 100644 x/compute/internal/keeper/recording_multistore.go diff --git a/Makefile b/Makefile index 9068130fbd..efbaa6f243 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,9 @@ go.sum: go.mod build_cli: CGO_LDFLAGS=$(CGO_LDFLAGS) go build -o secretcli -mod=readonly $(GCFLAGS) -tags "$(filter-out sgx, $(GO_TAGS)) secretcli" -ldflags '$(LD_FLAGS)' ./cmd/secretd +build-nosgx: + go build -o secretd-nosgx -mod=readonly $(GCFLAGS) -tags "$(filter-out sgx, $(GO_TAGS)) nosgx" -ldflags '$(LD_FLAGS)' ./cmd/secretd + build_local_no_rust: cp go-cosmwasm/target/$(BUILD_PROFILE)/libgo_cosmwasm.so go-cosmwasm/api CGO_LDFLAGS=$(CGO_LDFLAGS) go build -mod=readonly $(GCFLAGS) -tags "$(GO_TAGS)" -ldflags '$(LD_FLAGS)' ./cmd/secretd diff --git a/app/app.go b/app/app.go index d2ff3a58fa..dd98633ce8 100644 --- a/app/app.go +++ b/app/app.go @@ -528,7 +528,23 @@ func (app *SecretNetworkApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalize // EndBlocker application updates every end block func (app *SecretNetworkApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { - return app.mm.EndBlock(ctx) + resp, err := app.mm.EndBlock(ctx) + + // DUMP STATE FOR DIVERGENT BLOCK + if ctx.BlockHeight() == 24066603 { + fmt.Printf("\n==== INTERCEPTED ENDBLOCK AT 24066603 ====\n") + // Dump ALL events accumulated in the block + eventsJSON, _ := tmjson.MarshalIndent(ctx.EventManager().Events(), "", " ") + + errWrite := os.WriteFile("divergent_events_24066603.json", eventsJSON, 0o644) + if errWrite != nil { + fmt.Printf("Failed to write events to file: %v\n", errWrite) + } else { + fmt.Printf("Wrote divergent EndBlock events to divergent_events_24066603.json\n") + } + } + + return resp, err } // InitChainer application update at chain initialization diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 692ffdd86e..1fc1700f02 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -552,6 +552,17 @@ func (ak *SecretAppKeepers) InitCustomKeepers( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) ak.ComputeKeeper = &computeKeeper + + // Provide registered StoreKey instances so ApplyCrossModuleOps + // resolves names to the exact pointers CacheMultiStore expects. + { + sk := make(map[string]storetypes.StoreKey, len(ak.keys)) + for name, key := range ak.keys { + sk[name] = key + } + ak.ComputeKeeper.SetStoreKeys(sk) + } + wasmHooks.ContractKeeper = ak.ComputeKeeper // Compute receive: Switch -> Fee -> Packet Forward -> WASM Hooks diff --git a/app/upgrades/v1.23.3/upgrade.go b/app/upgrades/v1.23.3/upgrade.go new file mode 100644 index 0000000000..6313cb9a33 --- /dev/null +++ b/app/upgrades/v1.23.3/upgrade.go @@ -0,0 +1,39 @@ +package v1_23_2 + +import ( + "context" + "fmt" + "os" + + "cosmossdk.io/log" + store "cosmossdk.io/store/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/scrtlabs/SecretNetwork/app/keepers" + "github.com/scrtlabs/SecretNetwork/app/upgrades" +) + +const upgradeName = "v1.23.3" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: upgradeName, + CreateUpgradeHandler: createUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} + +func createUpgradeHandler(mm *module.Manager, _ *keepers.SecretAppKeepers, configurator module.Configurator, +) upgradetypes.UpgradeHandler { + return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + logger := log.NewLogger(os.Stderr) + logger.Info(` _ _ _____ _____ _____ _____ ______ `) + logger.Info(`| | | | __ \ / ____| __ \ /\ | __ \| ____|`) + logger.Info(`| | | | |__) | | __| |__) | / \ | | | | |__ `) + logger.Info(`| | | | ___/| | |_ | _ / / /\ \ | | | | __| `) + logger.Info(`| |__| | | | |__| | | \ \ / ____ \| |__| | |____ `) + logger.Info(` \____/|_| \_____|_| \_\/_/ \_\_____/|______|`) + + logger.Info(fmt.Sprintf("Running module migrations for %s...", upgradeName)) + + return mm.RunMigrations(ctx, configurator, vm) + } +} diff --git a/cmd/secretd/root.go b/cmd/secretd/root.go index 1a55d4c328..c6f83a356f 100644 --- a/cmd/secretd/root.go +++ b/cmd/secretd/root.go @@ -341,10 +341,16 @@ func newApp_internal(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts panic(err) } + // Get compute config and set environment variable for recorder + computeConfig := compute.GetConfig(appOpts) + if computeConfig.StoreSGXData { + os.Setenv("SECRET_STORE_SGX_DATA", "true") + } + res := app.NewSecretNetworkApp(logger, db, traceStore, true, bootstrap, appOpts, - compute.GetConfig(appOpts), + computeConfig, baseapp.SetPruning(pruningOpts), baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))), diff --git a/go-cosmwasm/api/callbacks.go b/go-cosmwasm/api/callbacks.go index db5a7cb139..75420d52aa 100644 --- a/go-cosmwasm/api/callbacks.go +++ b/go-cosmwasm/api/callbacks.go @@ -1,5 +1,5 @@ -//go:build !secretcli -// +build !secretcli +//go:build !secretcli && !nosgx +// +build !secretcli,!nosgx package api @@ -84,6 +84,14 @@ type Gas = uint64 // https://github.com/cosmos/cosmos-sdk/blob/18890a225b46260a9adc587be6fa1cc2aff101cd/store/types/gas.go#L34 type GasMeter interface { GasConsumed() Gas + ConsumeGas(amount Gas, descriptor string) +} + +// OriginalGasMeter is an interface for gas meters that wrap another meter +// This allows us to access the underlying meter for accurate callback gas measurement +type OriginalGasMeter interface { + GasMeter + OriginalMeter() GasMeter } /****** DB ********/ diff --git a/go-cosmwasm/api/callbacks_cgo.go b/go-cosmwasm/api/callbacks_cgo.go index b208d21d35..72ada69e05 100644 --- a/go-cosmwasm/api/callbacks_cgo.go +++ b/go-cosmwasm/api/callbacks_cgo.go @@ -1,5 +1,5 @@ -//go:build !secretcli -// +build !secretcli +//go:build !secretcli && !nosgx +// +build !secretcli,!nosgx package api diff --git a/go-cosmwasm/api/callbacks_mock.go b/go-cosmwasm/api/callbacks_mock.go index 5380f08f3e..26afe50234 100644 --- a/go-cosmwasm/api/callbacks_mock.go +++ b/go-cosmwasm/api/callbacks_mock.go @@ -92,6 +92,7 @@ type Gas = uint64 // // https://github.com/cosmos/cosmos-sdk/blob/18890a225b46260a9adc587be6fa1cc2aff101cd/store/types/gas.go#L34 type GasMeter interface { GasConsumed() Gas + ConsumeGas(amount Gas, descriptor string) } // /****** DB ********/ diff --git a/go-cosmwasm/api/callbacks_nosgx.go b/go-cosmwasm/api/callbacks_nosgx.go new file mode 100644 index 0000000000..0ea39d8891 --- /dev/null +++ b/go-cosmwasm/api/callbacks_nosgx.go @@ -0,0 +1,34 @@ +//go:build !secretcli && nosgx + +package api + +import ( + dbm "github.com/cosmos/cosmos-db" +) + +const GasMultiplier = 1000 + +type Gas = uint64 + +type GasMeter interface { + GasConsumed() Gas + ConsumeGas(amount Gas, descriptor string) +} + +type KVStore interface { + Get(key []byte) []byte + Set(key, value []byte) + Delete(key []byte) + Iterator(start, end []byte) dbm.Iterator + ReverseIterator(start, end []byte) dbm.Iterator +} + +type ( + HumanAddress func([]byte) (string, uint64, error) + CanonicalAddress func(string) ([]byte, uint64, error) +) + +type GoAPI struct { + HumanAddress HumanAddress + CanonicalAddress CanonicalAddress +} diff --git a/go-cosmwasm/api/ecall_client.go b/go-cosmwasm/api/ecall_client.go new file mode 100644 index 0000000000..129df58789 --- /dev/null +++ b/go-cosmwasm/api/ecall_client.go @@ -0,0 +1,643 @@ +//go:build !secretcli +// +build !secretcli + +package api + +import ( + "context" + "encoding/json" + "fmt" + "math/rand" + "os" + "path/filepath" + "sync" + "time" + + "github.com/gogo/protobuf/proto" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/status" +) + +// EcallClient fetches ecall records from remote SGX nodes via gRPC +// It maintains connections to multiple nodes and selects randomly for load distribution +type EcallClient struct { + mu sync.RWMutex + nodes []*nodeConn // Pool of node connections + timeout time.Duration + rng *rand.Rand +} + +// nodeConn represents a connection to a single SGX node +type nodeConn struct { + addr string + conn *grpc.ClientConn + mu sync.Mutex + failed bool // Mark node as failed to avoid repeated connection attempts +} + +// sgxNodesConfig represents the JSON configuration file format +type sgxNodesConfig struct { + Nodes []string `json:"nodes"` // List of gRPC addresses (host:port) +} + +// EcallRecordData represents the ecall record for a block +type EcallRecordData struct { + Height int64 + RandomSeed []byte + ValidatorSetEvidence []byte +} + +// Proto message types (matching secret.compute.v1beta1.Query*) +// Defined locally to avoid import cycles + +// QueryEcallRecordRequest matches QueryEcallRecordRequest proto +type QueryEcallRecordRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryEcallRecordRequest) Reset() { *m = QueryEcallRecordRequest{} } +func (m *QueryEcallRecordRequest) String() string { return fmt.Sprintf("{Height:%d}", m.Height) } +func (m *QueryEcallRecordRequest) ProtoMessage() {} + +// QueryEcallRecordResponse matches QueryEcallRecordResponse proto +type QueryEcallRecordResponse struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + RandomSeed []byte `protobuf:"bytes,2,opt,name=random_seed,json=randomSeed,proto3" json:"random_seed,omitempty"` + ValidatorSetEvidence []byte `protobuf:"bytes,3,opt,name=validator_set_evidence,json=validatorSetEvidence,proto3" json:"validator_set_evidence,omitempty"` +} + +func (m *QueryEcallRecordResponse) Reset() { *m = QueryEcallRecordResponse{} } +func (m *QueryEcallRecordResponse) String() string { return fmt.Sprintf("{Height:%d}", m.Height) } +func (m *QueryEcallRecordResponse) ProtoMessage() {} + +// QueryEncryptedSeedRequest matches QueryEncryptedSeedRequest proto +type QueryEncryptedSeedRequest struct { + CertHash string `protobuf:"bytes,1,opt,name=cert_hash,json=certHash,proto3" json:"cert_hash,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryEncryptedSeedRequest) Reset() { *m = QueryEncryptedSeedRequest{} } +func (m *QueryEncryptedSeedRequest) String() string { return fmt.Sprintf("{CertHash:%s,Height:%d}", m.CertHash, m.Height) } +func (m *QueryEncryptedSeedRequest) ProtoMessage() {} + +// QueryEncryptedSeedResponse matches QueryEncryptedSeedResponse proto +type QueryEncryptedSeedResponse struct { + EncryptedSeed []byte `protobuf:"bytes,1,opt,name=encrypted_seed,json=encryptedSeed,proto3" json:"encrypted_seed,omitempty"` +} + +func (m *QueryEncryptedSeedResponse) Reset() { *m = QueryEncryptedSeedResponse{} } +func (m *QueryEncryptedSeedResponse) String() string { + return fmt.Sprintf("{len:%d}", len(m.EncryptedSeed)) +} +func (m *QueryEncryptedSeedResponse) ProtoMessage() {} + +// StorageOpProto matches the proto definition for storage operation +type StorageOpProto struct { + IsDelete bool `protobuf:"varint,1,opt,name=is_delete,json=isDelete,proto3" json:"is_delete,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *StorageOpProto) Reset() { *m = StorageOpProto{} } +func (m *StorageOpProto) String() string { return fmt.Sprintf("{IsDelete:%v}", m.IsDelete) } +func (m *StorageOpProto) ProtoMessage() {} + +// CrossModuleOpProto matches the proto definition for cross-module storage operation +type CrossModuleOpProto struct { + StoreKey string `protobuf:"bytes,1,opt,name=store_key,json=storeKey,proto3" json:"store_key,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + IsDelete bool `protobuf:"varint,4,opt,name=is_delete,json=isDelete,proto3" json:"is_delete,omitempty"` +} + +func (m *CrossModuleOpProto) Reset() { *m = CrossModuleOpProto{} } +func (m *CrossModuleOpProto) String() string { return fmt.Sprintf("{StoreKey:%s}", m.StoreKey) } +func (m *CrossModuleOpProto) ProtoMessage() {} + +// QueryBlockTracesRequest matches QueryBlockTracesRequest proto +type QueryBlockTracesRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryBlockTracesRequest) Reset() { *m = QueryBlockTracesRequest{} } +func (m *QueryBlockTracesRequest) String() string { return fmt.Sprintf("{Height:%d}", m.Height) } +func (m *QueryBlockTracesRequest) ProtoMessage() {} + +// ExecutionTraceProto matches the proto definition +type ExecutionTraceProto struct { + Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + Ops []*StorageOpProto `protobuf:"bytes,2,rep,name=ops,proto3" json:"ops,omitempty"` + Result []byte `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` + GasUsed uint64 `protobuf:"varint,4,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + CallbackGas uint64 `protobuf:"varint,7,opt,name=callback_gas,json=callbackGas,proto3" json:"callback_gas,omitempty"` + HasError bool `protobuf:"varint,5,opt,name=has_error,json=hasError,proto3" json:"has_error,omitempty"` + ErrorMsg string `protobuf:"bytes,6,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` + CrossOps []*CrossModuleOpProto `protobuf:"bytes,8,rep,name=cross_ops,json=crossOps,proto3" json:"cross_ops,omitempty"` +} + +func (m *ExecutionTraceProto) Reset() { *m = ExecutionTraceProto{} } +func (m *ExecutionTraceProto) String() string { return fmt.Sprintf("{Index:%d}", m.Index) } +func (m *ExecutionTraceProto) ProtoMessage() {} + +// QueryBlockTracesResponse matches QueryBlockTracesResponse proto +type QueryBlockTracesResponse struct { + Traces []*ExecutionTraceProto `protobuf:"bytes,1,rep,name=traces,proto3" json:"traces,omitempty"` +} + +func (m *QueryBlockTracesResponse) Reset() { *m = QueryBlockTracesResponse{} } +func (m *QueryBlockTracesResponse) String() string { + return fmt.Sprintf("{NumTraces:%d}", len(m.Traces)) +} +func (m *QueryBlockTracesResponse) ProtoMessage() {} + +// QueryAnalyzeCodeRequest matches QueryAnalyzeCodeRequest proto +type QueryAnalyzeCodeRequest struct { + CodeHash []byte `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` +} + +func (m *QueryAnalyzeCodeRequest) Reset() { *m = QueryAnalyzeCodeRequest{} } +func (m *QueryAnalyzeCodeRequest) String() string { return fmt.Sprintf("{CodeHash:%x}", m.CodeHash) } +func (m *QueryAnalyzeCodeRequest) ProtoMessage() {} + +// QueryAnalyzeCodeResponse matches QueryAnalyzeCodeResponse proto +type QueryAnalyzeCodeResponse struct { + HasIBCEntryPoints bool `protobuf:"varint,1,opt,name=has_ibc_entry_points,json=hasIbcEntryPoints,proto3" json:"has_ibc_entry_points,omitempty"` + RequiredFeatures string `protobuf:"bytes,2,opt,name=required_features,json=requiredFeatures,proto3" json:"required_features,omitempty"` +} + +func (m *QueryAnalyzeCodeResponse) Reset() { *m = QueryAnalyzeCodeResponse{} } +func (m *QueryAnalyzeCodeResponse) String() string { return fmt.Sprintf("{HasIBC:%v}", m.HasIBCEntryPoints) } +func (m *QueryAnalyzeCodeResponse) ProtoMessage() {} + +// QueryMachineIDProofRequest matches QueryMachineIDProofRequest proto +type QueryMachineIDProofRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + MachineId string `protobuf:"bytes,2,opt,name=machine_id,json=machineId,proto3" json:"machine_id,omitempty"` +} + +func (m *QueryMachineIDProofRequest) Reset() { *m = QueryMachineIDProofRequest{} } +func (m *QueryMachineIDProofRequest) String() string { return fmt.Sprintf("{Height:%d,MachineId:%s}", m.Height, m.MachineId) } +func (m *QueryMachineIDProofRequest) ProtoMessage() {} + +// QueryMachineIDProofResponse matches QueryMachineIDProofResponse proto +type QueryMachineIDProofResponse struct { + Proof []byte `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` +} + +func (m *QueryMachineIDProofResponse) Reset() { *m = QueryMachineIDProofResponse{} } +func (m *QueryMachineIDProofResponse) String() string { return fmt.Sprintf("{len:%d}", len(m.Proof)) } +func (m *QueryMachineIDProofResponse) ProtoMessage() {} + +// CreateResultDataProto matches the proto definition for a Create (MsgStoreCode) result +type CreateResultDataProto struct { + WasmHash []byte `protobuf:"bytes,1,opt,name=wasm_hash,json=wasmHash,proto3" json:"wasm_hash,omitempty"` + CodeHash []byte `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` + HasError bool `protobuf:"varint,3,opt,name=has_error,json=hasError,proto3" json:"has_error,omitempty"` + ErrorMsg string `protobuf:"bytes,4,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` +} + +func (m *CreateResultDataProto) Reset() { *m = CreateResultDataProto{} } +func (m *CreateResultDataProto) String() string { return fmt.Sprintf("{WasmHash:%x}", m.WasmHash) } +func (m *CreateResultDataProto) ProtoMessage() {} + +// QueryBlockCreateResultsRequest matches QueryBlockCreateResultsRequest proto +type QueryBlockCreateResultsRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryBlockCreateResultsRequest) Reset() { *m = QueryBlockCreateResultsRequest{} } +func (m *QueryBlockCreateResultsRequest) String() string { return fmt.Sprintf("{Height:%d}", m.Height) } +func (m *QueryBlockCreateResultsRequest) ProtoMessage() {} + +// QueryBlockCreateResultsResponse matches QueryBlockCreateResultsResponse proto +type QueryBlockCreateResultsResponse struct { + Results []*CreateResultDataProto `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` +} + +func (m *QueryBlockCreateResultsResponse) Reset() { *m = QueryBlockCreateResultsResponse{} } +func (m *QueryBlockCreateResultsResponse) String() string { + return fmt.Sprintf("{NumResults:%d}", len(m.Results)) +} +func (m *QueryBlockCreateResultsResponse) ProtoMessage() {} + +const ( + methodEcallRecord = "/secret.compute.v1beta1.Query/EcallRecord" + methodEncryptedSeed = "/secret.compute.v1beta1.Query/EncryptedSeed" + methodBlockTraces = "/secret.compute.v1beta1.Query/BlockTraces" + methodAnalyzeCode = "/secret.compute.v1beta1.Query/AnalyzeCode" + methodMachineIDProof = "/secret.compute.v1beta1.Query/MachineIDProof" + methodBlockCreateResults = "/secret.compute.v1beta1.Query/BlockCreateResults" +) + +var ( + globalClient *EcallClient + clientOnce sync.Once +) + +// Ensure our types implement proto.Message +var ( + _ proto.Message = (*QueryEcallRecordRequest)(nil) + _ proto.Message = (*QueryEcallRecordResponse)(nil) + _ proto.Message = (*QueryEncryptedSeedRequest)(nil) + _ proto.Message = (*QueryEncryptedSeedResponse)(nil) + _ proto.Message = (*StorageOpProto)(nil) + _ proto.Message = (*CrossModuleOpProto)(nil) + _ proto.Message = (*QueryBlockTracesRequest)(nil) + _ proto.Message = (*QueryBlockTracesResponse)(nil) + _ proto.Message = (*ExecutionTraceProto)(nil) + _ proto.Message = (*QueryAnalyzeCodeRequest)(nil) + _ proto.Message = (*QueryAnalyzeCodeResponse)(nil) + _ proto.Message = (*CreateResultDataProto)(nil) + _ proto.Message = (*QueryBlockCreateResultsRequest)(nil) + _ proto.Message = (*QueryBlockCreateResultsResponse)(nil) +) + +// GetEcallClient returns the global ecall client instance +func GetEcallClient() *EcallClient { + clientOnce.Do(func() { + var addrs []string + + // Try to load from JSON file first + configPath := os.Getenv("SECRET_SGX_NODES_CONFIG") + if configPath == "" { + // Default path: ~/.secretd/config/sgx_nodes.json + homeDir := os.Getenv("HOME") + secretHome := os.Getenv("SECRETD_HOME") + if secretHome != "" { + configPath = filepath.Join(secretHome, "config", "sgx_nodes.json") + } else { + configPath = filepath.Join(homeDir, ".secretd", "config", "sgx_nodes.json") + } + } + + if addrsFromFile := loadNodesFromJSON(configPath); len(addrsFromFile) > 0 { + addrs = addrsFromFile + logInfo("EcallClient", "Loaded %d nodes from config file: %s", len(addrs), configPath) + } else { + // Fallback to env var + grpcAddr := os.Getenv("SECRET_SGX_NODE_GRPC") + if grpcAddr == "" { + grpcAddr = "localhost:9090" + } + addrs = []string{grpcAddr} + logInfo("EcallClient", "Using single node from env: %s", grpcAddr) + } + + nodes := make([]*nodeConn, len(addrs)) + for i, addr := range addrs { + nodes[i] = &nodeConn{addr: addr} + } + + globalClient = &EcallClient{ + nodes: nodes, + timeout: 30 * time.Second, + rng: rand.New(rand.NewSource(time.Now().UnixNano())), + } + + logInfo("EcallClient", "Initialized with %d SGX nodes", len(addrs)) + }) + return globalClient +} + +// loadNodesFromJSON loads gRPC node addresses from a JSON configuration file +// JSON format: {"nodes": ["node1:9090", "node2:9090", "node3:9090"]} +func loadNodesFromJSON(configPath string) []string { + data, err := os.ReadFile(configPath) + if err != nil { + // File doesn't exist or can't be read - that's okay, use fallback + return nil + } + + var config sgxNodesConfig + if err := json.Unmarshal(data, &config); err != nil { + logWarn("EcallClient", "Failed to parse config file %s: %v", configPath, err) + return nil + } + + if len(config.Nodes) == 0 { + return nil + } + + // Validate and filter out empty addresses + var validAddrs []string + for _, addr := range config.Nodes { + if addr != "" { + validAddrs = append(validAddrs, addr) + } + } + + return validAddrs +} + +// getRandomNode returns a random healthy node connection +// It tries up to len(nodes) times to find a working connection +func (c *EcallClient) getRandomNode() (*grpc.ClientConn, string, error) { + c.mu.RLock() + numNodes := len(c.nodes) + if numNodes == 0 { + c.mu.RUnlock() + return nil, "", fmt.Errorf("no SGX nodes configured") + } + + // Create shuffled indices for random selection without replacement + indices := make([]int, numNodes) + for i := range indices { + indices[i] = i + } + c.rng.Shuffle(len(indices), func(i, j int) { + indices[i], indices[j] = indices[j], indices[i] + }) + c.mu.RUnlock() + + // Try each node in random order until one works + var lastErr error + for _, idx := range indices { + c.mu.RLock() + if idx >= len(c.nodes) { + c.mu.RUnlock() + continue + } + node := c.nodes[idx] + c.mu.RUnlock() + + conn, err := c.ensureConnection(node) + if err != nil { + lastErr = err + continue + } + return conn, node.addr, nil + } + + return nil, "", fmt.Errorf("all SGX nodes unavailable: %w", lastErr) +} + +// ensureConnection ensures the node has an active connection, creating one if needed +func (c *EcallClient) ensureConnection(node *nodeConn) (*grpc.ClientConn, error) { + node.mu.Lock() + defer node.mu.Unlock() + + // Already connected + if node.conn != nil { + return node.conn, nil + } + + // Try to connect (with short timeout to not block too long) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + conn, err := grpc.DialContext( + ctx, + node.addr, + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithBlock(), + ) + if err != nil { + node.failed = true + return nil, fmt.Errorf("failed to connect to %s: %w", node.addr, err) + } + + node.conn = conn + node.failed = false + return conn, nil +} + +// markNodeFailed marks a node as failed after a request error +func (c *EcallClient) markNodeFailed(addr string) { + c.mu.RLock() + defer c.mu.RUnlock() + + for _, n := range c.nodes { + if n.addr == addr { + n.mu.Lock() + n.failed = true + if n.conn != nil { + n.conn.Close() + n.conn = nil + } + n.mu.Unlock() + return + } + } +} + +// Close closes all gRPC connections +func (c *EcallClient) Close() error { + c.mu.Lock() + defer c.mu.Unlock() + + for _, n := range c.nodes { + n.mu.Lock() + if n.conn != nil { + n.conn.Close() + n.conn = nil + } + n.mu.Unlock() + } + return nil +} + +// invokeWithRetry invokes a gRPC method with automatic retry on different nodes +func (c *EcallClient) invokeWithRetry(method string, req, resp proto.Message) error { + c.mu.RLock() + maxRetries := len(c.nodes) + if maxRetries < 1 { + maxRetries = 1 + } + if maxRetries > 5 { + maxRetries = 5 // Cap retries to avoid too many attempts + } + c.mu.RUnlock() + + var lastErr error + for attempt := 0; attempt < maxRetries; attempt++ { + conn, nodeAddr, err := c.getRandomNode() + if err != nil { + lastErr = err + continue + } + + ctx, cancel := context.WithTimeout(context.Background(), c.timeout) + err = conn.Invoke(ctx, method, req, resp) + cancel() + + if err == nil { + return nil + } + + // Don't retry on non-transient gRPC errors + if st, ok := status.FromError(err); ok { + switch st.Code() { + case codes.FailedPrecondition, codes.NotFound, codes.InvalidArgument, codes.PermissionDenied: + return err // Return immediately, don't retry semantic errors + } + } + + lastErr = err + c.markNodeFailed(nodeAddr) + logWarn("EcallClient", "Request to %s failed (attempt %d/%d): %v", nodeAddr, attempt+1, maxRetries, err) + } + + return fmt.Errorf("all retry attempts failed: %w", lastErr) +} + +// FetchEcallRecord fetches a single ecall record from a random SGX node +func (c *EcallClient) FetchEcallRecord(height int64) (*EcallRecordData, error) { + req := &QueryEcallRecordRequest{Height: height} + resp := &QueryEcallRecordResponse{} + + if err := c.invokeWithRetry(methodEcallRecord, req, resp); err != nil { + return nil, fmt.Errorf("gRPC EcallRecord failed for height %d: %w", height, err) + } + + if height%1000 == 0 { + logInfo("EcallClient", "Fetched ecall record for height %d", height) + } + + return &EcallRecordData{ + Height: resp.Height, + RandomSeed: resp.RandomSeed, + ValidatorSetEvidence: resp.ValidatorSetEvidence, + }, nil +} + +// FetchEncryptedSeed fetches encrypted seed data from a random SGX node +func (c *EcallClient) FetchEncryptedSeed(height int64, certHashHex string) ([]byte, error) { + req := &QueryEncryptedSeedRequest{CertHash: certHashHex, Height: height} + resp := &QueryEncryptedSeedResponse{} + + if err := c.invokeWithRetry(methodEncryptedSeed, req, resp); err != nil { + return nil, err // Return raw error to preserve gRPC status codes + } + + logInfo("EcallClient", "Fetched encrypted seed (%d bytes) at height %d", len(resp.EncryptedSeed), height) + return resp.EncryptedSeed, nil +} + +// FetchMachineIDProof fetches a machine ID proof for a given height and machine ID from a random SGX node +func (c *EcallClient) FetchMachineIDProof(height int64, machineIDHex string) ([]byte, error) { + req := &QueryMachineIDProofRequest{Height: height, MachineId: machineIDHex} + resp := &QueryMachineIDProofResponse{} + + if err := c.invokeWithRetry(methodMachineIDProof, req, resp); err != nil { + return nil, fmt.Errorf("gRPC MachineIDProof failed for height %d: %w", height, err) + } + + logInfo("EcallClient", "Fetched machine ID proof (%d bytes) for height %d", len(resp.Proof), height) + return resp.Proof, nil +} + +// FetchBlockTraces fetches all execution traces for a block from a random SGX node +func (c *EcallClient) FetchBlockTraces(height int64) ([]*ExecutionTrace, error) { + req := &QueryBlockTracesRequest{Height: height} + resp := &QueryBlockTracesResponse{} + + if err := c.invokeWithRetry(methodBlockTraces, req, resp); err != nil { + return nil, fmt.Errorf("gRPC BlockTraces failed for height %d: %w", height, err) + } + + // Convert proto response to ExecutionTrace slice + traces := make([]*ExecutionTrace, len(resp.Traces)) + for i, t := range resp.Traces { + logDebug("EcallClient", "Proto trace callbackGas=%d (from gRPC response)", t.CallbackGas) + ops := make([]StorageOp, len(t.Ops)) + for j, op := range t.Ops { + value := op.Value + if !op.IsDelete && value == nil { + value = []byte{} + } + ops[j] = StorageOp{ + IsDelete: op.IsDelete, + Key: op.Key, + Value: value, + } + } + // Convert cross-module ops (e.g., distribution store writes from staking queries) + crossOps := make([]CrossModuleOp, len(t.CrossOps)) + for j, cop := range t.CrossOps { + crossOps[j] = CrossModuleOp{ + StoreKey: cop.StoreKey, + Key: cop.Key, + Value: cop.Value, + IsDelete: cop.IsDelete, + } + } + traces[i] = &ExecutionTrace{ + Index: t.Index, + Ops: ops, + CrossOps: crossOps, + Result: t.Result, + GasUsed: t.GasUsed, + CallbackGas: t.CallbackGas, + HasError: t.HasError, + ErrorMsg: t.ErrorMsg, + } + logDebug("EcallClient", "Converted trace callbackGas=%d crossOps=%d", traces[i].CallbackGas, len(crossOps)) + } + + if len(traces) > 0 { + for _, t := range traces { + logDebug("EcallClient", "Fetched trace: height=%d index=%d ops=%d resultLen=%d gasUsed=%d callbackGas=%d hasError=%v", + height, t.Index, len(t.Ops), len(t.Result), t.GasUsed, t.CallbackGas, t.HasError) + } + } else if height%1000 == 0 { + logInfo("EcallClient", "Fetched %d traces for block %d", len(traces), height) + } + return traces, nil +} + +// FetchAnalyzeCode fetches the AnalyzeCode result for a code hash from a random SGX node +func (c *EcallClient) FetchAnalyzeCode(codeHash []byte) (bool, string, error) { + req := &QueryAnalyzeCodeRequest{CodeHash: codeHash} + resp := &QueryAnalyzeCodeResponse{} + + if err := c.invokeWithRetry(methodAnalyzeCode, req, resp); err != nil { + return false, "", fmt.Errorf("gRPC AnalyzeCode failed for code hash %x: %w", codeHash, err) + } + + logInfo("EcallClient", "Fetched AnalyzeCode for %x: hasIBC=%v features=%s", codeHash, resp.HasIBCEntryPoints, resp.RequiredFeatures) + return resp.HasIBCEntryPoints, resp.RequiredFeatures, nil +} + +// IsConnected returns true if at least one node is connected +func (c *EcallClient) IsConnected() bool { + c.mu.RLock() + defer c.mu.RUnlock() + + for _, n := range c.nodes { + n.mu.Lock() + connected := n.conn != nil + n.mu.Unlock() + if connected { + return true + } + } + return false +} + +// FetchBlockCreateResults fetches all Create (MsgStoreCode) results for a block from a random SGX node +func (c *EcallClient) FetchBlockCreateResults(height int64) ([]*CreateResult, [][]byte, error) { + req := &QueryBlockCreateResultsRequest{Height: height} + resp := &QueryBlockCreateResultsResponse{} + + if err := c.invokeWithRetry(methodBlockCreateResults, req, resp); err != nil { + return nil, nil, fmt.Errorf("gRPC BlockCreateResults failed for height %d: %w", height, err) + } + + results := make([]*CreateResult, len(resp.Results)) + wasmHashes := make([][]byte, len(resp.Results)) + for i, r := range resp.Results { + wasmHashes[i] = r.WasmHash + results[i] = &CreateResult{ + CodeHash: r.CodeHash, + HasError: r.HasError, + ErrorMsg: r.ErrorMsg, + } + } + + if len(results) > 0 { + logInfo("EcallClient", "Fetched %d Create results for block %d", len(results), height) + } + return results, wasmHashes, nil +} diff --git a/go-cosmwasm/api/ecall_client_stub.go b/go-cosmwasm/api/ecall_client_stub.go new file mode 100644 index 0000000000..f77cf9ba6b --- /dev/null +++ b/go-cosmwasm/api/ecall_client_stub.go @@ -0,0 +1,25 @@ +//go:build secretcli +// +build secretcli + +package api + +// Stub implementations for secretcli builds (no SGX support) + +// EcallClient stub for secretcli +type EcallClient struct{} + +// EcallRecordData stub +type EcallRecordData struct { + Height int64 + RandomSeed []byte + ValidatorSetEvidence []byte +} + +func GetEcallClient() *EcallClient { return nil } +func (c *EcallClient) FetchEcallRecord(int64) (*EcallRecordData, error) { return nil, nil } +func (c *EcallClient) FetchEncryptedSeed(int64, string) ([]byte, error) { return nil, nil } +func (c *EcallClient) FetchBlockTraces(int64) ([]*ExecutionTrace, error) { return nil, nil } +func (c *EcallClient) FetchBlockCreateResults(int64) ([]*CreateResult, [][]byte, error) { return nil, nil, nil } +func (c *EcallClient) Close() error { return nil } +func (c *EcallClient) SetGrpcAddr(string) error { return nil } +func (c *EcallClient) IsConnected() bool { return false } diff --git a/go-cosmwasm/api/ecall_record.go b/go-cosmwasm/api/ecall_record.go new file mode 100644 index 0000000000..d8fa302355 --- /dev/null +++ b/go-cosmwasm/api/ecall_record.go @@ -0,0 +1,916 @@ +//go:build !secretcli +// +build !secretcli + +package api + +import ( + "encoding/binary" + "fmt" + "os" + "path/filepath" + "sync" + "sync/atomic" + + dbm "github.com/cosmos/cosmos-db" + "github.com/gogo/protobuf/proto" +) + +// NodeMode determines how the node handles SGX enclave calls +type NodeMode string + +const ( + // NodeModeSGX - Run with real SGX enclave and record outputs + NodeModeSGX NodeMode = "sgx" + // NodeModeReplay - Replay recorded outputs without SGX + NodeModeReplay NodeMode = "replay" +) + +// EcallRecorder handles recording and replaying ecall data using LevelDB +type EcallRecorder struct { + mu sync.RWMutex + mode NodeMode + db dbm.DB + + // Block-scoped execution tracking + currentBlockHeight int64 + executionIndex int64 + + // In-memory cache for current block's traces (replay mode) + blockTracesMu sync.RWMutex + blockTraces map[int64]*ExecutionTrace // key: execution index + + // Pending cross-module ops collected during the current execution. + // Set by keeper (via SetPendingCrossModuleOps) before wasmer.Execute, + // consumed by lib.go (via GetAndClearPendingCrossModuleOps) when building the trace. + pendingCrossOpsMu sync.Mutex + pendingCrossOps []CrossModuleOp +} + +var ( + globalRecorder *EcallRecorder + recorderMu sync.Mutex +) + +// Key prefixes for different ecall types +var ( + prefixSubmitBlockSignatures = []byte{0x01} + prefixGetEncryptedSeed = []byte{0x02} + prefixExecutionTrace = []byte{0x03} // For contract execution: prefix | height | index + prefixMachineIDProof = []byte{0x04} // For MachineID approval: prefix | height | machineID + prefixCreateResult = []byte{0x05} // For Create (store code): prefix | height | sha256(wasm) + prefixGetEncryptedSeedErr = []byte{0x06} // For GetEncryptedSeed errors: prefix | certHash +) + +// CrossModuleOp represents a write to a module store other than the contract's +// own prefixed store. These happen as side-effects of Go querier callbacks +// (e.g. distribution's initializeDelegation during DelegationTotalRewards). +type CrossModuleOp struct { + StoreKey string // Module store key name (e.g. "distribution") + Key []byte + Value []byte // nil means delete + IsDelete bool +} + +// ExecutionTrace stores all storage operations from a contract execution +type ExecutionTrace struct { + Index int64 // Execution index within the block + Ops []StorageOp + CrossOps []CrossModuleOp // Cross-module mutations from query side-effects + Result []byte // The return value from the ecall + GasUsed uint64 // Gas reported by the enclave + CallbackGas uint64 // Total gas consumed by callbacks (store ops) during execution + HasError bool + IsOutOfGas bool // True when the enclave returned errno==2 (OutOfGas) + ErrorMsg string +} + +// DefaultRetentionBlocks is the default number of blocks to retain (~90 days at 6s blocks) +const DefaultRetentionBlocks int64 = 1296000 + +// PruneIntervalBlocks defines how often to run pruning (every 100 blocks) +const PruneIntervalBlocks int64 = 100 + +// GetRecorder returns the global ecall recorder instance +func GetRecorder() *EcallRecorder { + recorderMu.Lock() + defer recorderMu.Unlock() + + mode := NodeMode(os.Getenv("SECRET_NODE_MODE")) + if mode == "" { + mode = NodeModeSGX // Default to SGX mode + } + + // Check if storing SGX data is enabled (from config or env var) + storeSGXData := os.Getenv("SECRET_STORE_SGX_DATA") == "true" + + // If already initialized, check if we need to upgrade the recording state + if globalRecorder != nil { + hasDB := globalRecorder.db != nil + if mode == NodeModeReplay || storeSGXData == hasDB { + return globalRecorder + } + // Transitioning states (tempApp didn't have flag, but real app does) + if globalRecorder.db != nil { + globalRecorder.db.Close() + } + } + + if mode == NodeModeReplay || (mode == NodeModeSGX && !storeSGXData) { + globalRecorder = &EcallRecorder{ + mode: mode, + db: nil, + blockTraces: make(map[int64]*ExecutionTrace), + } + if mode == NodeModeReplay { + logInfo("EcallRecorder", "Initialized in replay mode (no local DB, fetches from remote)") + } else { + logInfo("EcallRecorder", "Initialized in %s mode (storing disabled)", mode) + } + return globalRecorder + } + + // Get database directory from env or use default (SGX mode with storing enabled only) + dbDir := os.Getenv("SECRET_ECALL_RECORD_DIR") + if dbDir == "" { + // Default to ~/.secretd/data/ + homeDir := os.Getenv("HOME") + secretHome := os.Getenv("SECRETD_HOME") + if secretHome != "" { + dbDir = filepath.Join(secretHome, "data") + } else { + dbDir = filepath.Join(homeDir, ".secretd", "data") + } + } + + // Ensure directory exists + if err := os.MkdirAll(dbDir, 0o755); err != nil { + logWarn("EcallRecorder", "Could not create db directory: %v", err) + } + + // Open LevelDB database + db, err := dbm.NewDB("ecall_records", dbm.GoLevelDBBackend, dbDir) + if err != nil { + logError("EcallRecorder", "Error opening database: %v", err) + // Create a nil recorder that will skip recording + globalRecorder = &EcallRecorder{ + mode: mode, + db: nil, + blockTraces: make(map[int64]*ExecutionTrace), + } + return globalRecorder + } + + globalRecorder = &EcallRecorder{ + mode: mode, + db: db, + blockTraces: make(map[int64]*ExecutionTrace), + } + + if storeSGXData { + logInfo("EcallRecorder", "Initialized in %s mode with storing enabled, db dir: %s", mode, dbDir) + } else { + logInfo("EcallRecorder", "Initialized in %s mode, db dir: %s", mode, dbDir) + } + + return globalRecorder +} + +// --- Block-scoped execution tracking --- + +// StartBlock initializes tracking for a new block, resetting the execution counter +func (r *EcallRecorder) StartBlock(height int64) { + atomic.StoreInt64(&r.currentBlockHeight, height) + atomic.StoreInt64(&r.executionIndex, 0) + + // Clear previous block's traces from memory + r.blockTracesMu.Lock() + r.blockTraces = make(map[int64]*ExecutionTrace) + r.blockTracesMu.Unlock() +} + +// NextExecutionIndex returns the next execution index and increments the counter +func (r *EcallRecorder) NextExecutionIndex() int64 { + return atomic.AddInt64(&r.executionIndex, 1) +} + +// GetCurrentBlockHeight returns the current block height being processed +func (r *EcallRecorder) GetCurrentBlockHeight() int64 { + return atomic.LoadInt64(&r.currentBlockHeight) +} + +// SetBlockTraces sets all traces for the current block (used in replay mode after batch fetch) +func (r *EcallRecorder) SetBlockTraces(traces []*ExecutionTrace) { + r.blockTracesMu.Lock() + defer r.blockTracesMu.Unlock() + + r.blockTraces = make(map[int64]*ExecutionTrace) + for _, trace := range traces { + r.blockTraces[trace.Index] = trace + logDebug("SetBlockTraces", "Stored trace at index=%d", trace.Index) + } +} + +// GetTraceFromMemory retrieves a trace from the in-memory cache +func (r *EcallRecorder) GetTraceFromMemory(index int64) (*ExecutionTrace, bool) { + r.blockTracesMu.RLock() + defer r.blockTracesMu.RUnlock() + + trace, found := r.blockTraces[index] + return trace, found +} + +// SetPendingCrossModuleOps replaces the pending cross-module ops list. +// Called by the keeper to initialize the list before a WASM execution. +func (r *EcallRecorder) SetPendingCrossModuleOps(ops []CrossModuleOp) { + r.pendingCrossOpsMu.Lock() + defer r.pendingCrossOpsMu.Unlock() + r.pendingCrossOps = ops +} + +// AppendCrossModuleOp adds a single cross-module op to the pending list. +// Called by the RecordingMultiStore when a cross-module write is observed. +func (r *EcallRecorder) AppendCrossModuleOp(op CrossModuleOp) { + r.pendingCrossOpsMu.Lock() + defer r.pendingCrossOpsMu.Unlock() + r.pendingCrossOps = append(r.pendingCrossOps, op) +} + +// GetAndClearPendingCrossModuleOps returns the accumulated cross-module ops +// and clears the pending list. Called by lib.go after wasmer.Execute to +// include the ops in the execution trace. +func (r *EcallRecorder) GetAndClearPendingCrossModuleOps() []CrossModuleOp { + r.pendingCrossOpsMu.Lock() + defer r.pendingCrossOpsMu.Unlock() + ops := r.pendingCrossOps + r.pendingCrossOps = nil + return ops +} + +// Mode returns the current node mode +func (r *EcallRecorder) Mode() NodeMode { + return r.mode +} + +func (r *EcallRecorder) IsSGXMode() bool { + return r.mode == NodeModeSGX && r.db != nil +} + +// IsReplayMode returns true if running in replay mode +func (r *EcallRecorder) IsReplayMode() bool { + return r.mode == NodeModeReplay +} + +// Close closes the database +func (r *EcallRecorder) Close() error { + if r.db != nil { + return r.db.Close() + } + return nil +} + +// --- Key generation helpers --- + +// makeBlockKey creates a key for block-height indexed data +func makeBlockKey(prefix []byte, height int64) []byte { + key := make([]byte, len(prefix)+8) + copy(key, prefix) + binary.BigEndian.PutUint64(key[len(prefix):], uint64(height)) + return key +} + +// --- SubmitBlockSignatures recording --- + +// RecordSubmitBlockSignatures records the output of SubmitBlockSignatures by block height +func (r *EcallRecorder) RecordSubmitBlockSignatures(height int64, random []byte, evidence []byte) error { + if r.db == nil { + // Storing is disabled (opt-in feature) - silently skip + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + // Combine random (32 bytes) and evidence (32 bytes) into 64 bytes + value := make([]byte, 64) + copy(value[:32], random) + copy(value[32:], evidence) + + key := makeBlockKey(prefixSubmitBlockSignatures, height) + if err := r.db.Set(key, value); err != nil { + return fmt.Errorf("failed to write to db: %w", err) + } + + // Only log every 1000 blocks to reduce noise + if height%1000 == 0 { + logInfo("EcallRecorder", "Recorded SubmitBlockSignatures for height %d", height) + } + return nil +} + +// ReplaySubmitBlockSignatures retrieves recorded SubmitBlockSignatures data by block height +func (r *EcallRecorder) ReplaySubmitBlockSignatures(height int64) (random []byte, evidence []byte, found bool) { + if r.db == nil { + return nil, nil, false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeBlockKey(prefixSubmitBlockSignatures, height) + value, err := r.db.Get(key) + if err != nil || value == nil || len(value) != 64 { + return nil, nil, false + } + + random = make([]byte, 32) + evidence = make([]byte, 32) + copy(random, value[:32]) + copy(evidence, value[32:]) + + // Only log every 1000 blocks to reduce noise + if height%1000 == 0 { + logInfo("EcallRecorder", "Replayed SubmitBlockSignatures for height %d", height) + } + return random, evidence, true +} + +// --- MachineID proof recording --- + +// makeMachineIDProofKey creates a key: prefix | height (8 bytes) | machineID +func makeMachineIDProofKey(height int64, machineID []byte) []byte { + key := make([]byte, len(prefixMachineIDProof)+8+len(machineID)) + copy(key, prefixMachineIDProof) + binary.BigEndian.PutUint64(key[len(prefixMachineIDProof):], uint64(height)) + copy(key[len(prefixMachineIDProof)+8:], machineID) + return key +} + +// RecordMachineIDProof records the proof output from OnApproveMachineID +func (r *EcallRecorder) RecordMachineIDProof(height int64, machineID []byte, proof []byte) error { + if r.db == nil { + // Storing is disabled - silently skip + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + key := makeMachineIDProofKey(height, machineID) + if err := r.db.Set(key, proof); err != nil { + return fmt.Errorf("failed to write machine ID proof to db: %w", err) + } + + logInfo("EcallRecorder", "Recorded MachineIDProof for height %d, machineID len=%d", height, len(machineID)) + return nil +} + +// ReplayMachineIDProof retrieves the recorded proof for a machine ID approval +func (r *EcallRecorder) ReplayMachineIDProof(height int64, machineID []byte) (proof []byte, found bool) { + if r.db == nil { + return nil, false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeMachineIDProofKey(height, machineID) + value, err := r.db.Get(key) + if err != nil || value == nil { + return nil, false + } + + logInfo("EcallRecorder", "Replayed MachineIDProof for height %d (%d bytes)", height, len(value)) + return value, true +} + +// --- GetEncryptedSeed recording (by height + cert hash) --- + +// makeSeedKey creates a key: prefix(1) | height(8) | certHash +func makeSeedKey(height int64, certHash []byte) []byte { + key := make([]byte, 1+8+len(certHash)) + key[0] = prefixGetEncryptedSeed[0] + binary.BigEndian.PutUint64(key[1:9], uint64(height)) + copy(key[9:], certHash) + return key +} + +// makeSeedErrKey creates a key: prefix(1) | height(8) | certHash +func makeSeedErrKey(height int64, certHash []byte) []byte { + key := make([]byte, 1+8+len(certHash)) + key[0] = prefixGetEncryptedSeedErr[0] + binary.BigEndian.PutUint64(key[1:9], uint64(height)) + copy(key[9:], certHash) + return key +} + +// RecordGetEncryptedSeed records the GetEncryptedSeed ecall output (success case) +// Key format: prefix(1) | height(8) | certHash +func (r *EcallRecorder) RecordGetEncryptedSeed(height int64, certHash []byte, output []byte) error { + if r.db == nil { + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + key := makeSeedKey(height, certHash) + if err := r.db.Set(key, output); err != nil { + return fmt.Errorf("failed to write to db: %w", err) + } + + logInfo("EcallRecorder", "Recorded GetEncryptedSeed success at height %d (%d bytes)", height, len(output)) + return nil +} + +// RecordGetEncryptedSeedError records a failed GetEncryptedSeed ecall with its error message +// Key format: prefix(1) | height(8) | certHash +func (r *EcallRecorder) RecordGetEncryptedSeedError(height int64, certHash []byte, errMsg string) error { + if r.db == nil { + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + key := makeSeedErrKey(height, certHash) + if err := r.db.Set(key, []byte(errMsg)); err != nil { + return fmt.Errorf("failed to write error to db: %w", err) + } + + logInfo("EcallRecorder", "Recorded GetEncryptedSeed error at height %d: %s", height, errMsg) + return nil +} + +// ReplayGetEncryptedSeed retrieves recorded GetEncryptedSeed data for a given height +// Returns (output, "", true) on recorded success, (nil, errMsg, true) on recorded error, (nil, "", false) if not found +func (r *EcallRecorder) ReplayGetEncryptedSeed(height int64, certHash []byte) (output []byte, errMsg string, found bool) { + if r.db == nil { + return nil, "", false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + // Check for error entry first (separate key prefix) + errKey := makeSeedErrKey(height, certHash) + errVal, err := r.db.Get(errKey) + if err == nil && errVal != nil && len(errVal) > 0 { + logInfo("EcallRecorder", "Replayed GetEncryptedSeed error at height %d", height) + return nil, string(errVal), true + } + + // Check for success entry + key := makeSeedKey(height, certHash) + value, err := r.db.Get(key) + if err != nil || value == nil { + return nil, "", false + } + + logInfo("EcallRecorder", "Replayed GetEncryptedSeed success at height %d (%d bytes)", height, len(value)) + return value, "", true +} + +// --- ExecutionTrace recording (for contract executions) --- + +// makeExecutionKey creates a key for height+index indexed execution traces +// Key format: prefix (1 byte) | height (8 bytes) | index (8 bytes) +func makeExecutionKey(height int64, index int64) []byte { + key := make([]byte, 1+8+8) + key[0] = prefixExecutionTrace[0] + binary.BigEndian.PutUint64(key[1:9], uint64(height)) + binary.BigEndian.PutUint64(key[9:17], uint64(index)) + return key +} + +// RecordExecutionTrace records contract execution storage ops and result +// Uses current block height and the provided execution index +func (r *EcallRecorder) RecordExecutionTrace(height int64, index int64, trace *ExecutionTrace) error { + if r.db == nil { + // Storing is disabled (opt-in feature) - silently skip + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + trace.Index = index + + logDebug("RecordExecutionTrace", "Storing trace height=%d index=%d callbackGas=%d", height, index, trace.CallbackGas) + + // Convert to protobuf and serialize + protoTrace := executionTraceToProto(trace) + data, err := proto.Marshal(protoTrace) + if err != nil { + return fmt.Errorf("failed to marshal trace: %w", err) + } + + logDebug("RecordExecutionTrace", "Serialized data length=%d", len(data)) + + key := makeExecutionKey(height, index) + if err := r.db.Set(key, data); err != nil { + return fmt.Errorf("failed to write to db: %w", err) + } + + // Verify we can read it back + readBack, err := r.db.Get(key) + if err == nil && readBack != nil { + var verifyProto ExecutionTraceProto + if err := proto.Unmarshal(readBack, &verifyProto); err == nil { + verifyTrace := protoToExecutionTrace(&verifyProto) + logDebug("RecordExecutionTrace", "Verified readback callbackGas=%d", verifyTrace.CallbackGas) + } + } + + return nil +} + +// ReplayExecutionTrace retrieves recorded execution trace by height and index +func (r *EcallRecorder) ReplayExecutionTrace(height int64, index int64) (*ExecutionTrace, bool) { + if r.db == nil { + return nil, false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeExecutionKey(height, index) + value, err := r.db.Get(key) + if err != nil || value == nil { + return nil, false + } + + // Deserialize protobuf + var protoTrace ExecutionTraceProto + if err := proto.Unmarshal(value, &protoTrace); err != nil { + logError("EcallRecorder", "Failed to deserialize trace: %v", err) + return nil, false + } + + trace := protoToExecutionTrace(&protoTrace) + return trace, true +} + +// GetAllTracesForBlock retrieves all execution traces for a given block height +func (r *EcallRecorder) GetAllTracesForBlock(height int64) ([]*ExecutionTrace, error) { + if r.db == nil { + return nil, fmt.Errorf("database not initialized") + } + + r.mu.RLock() + defer r.mu.RUnlock() + + // Create range for this block: [prefix|height|0, prefix|height|maxUint64] + startKey := makeExecutionKey(height, 0) + endKey := makeExecutionKey(height+1, 0) // Next block's start is this block's end + + iter, err := r.db.Iterator(startKey, endKey) + if err != nil { + return nil, fmt.Errorf("failed to create iterator: %w", err) + } + defer iter.Close() + + var traces []*ExecutionTrace + for ; iter.Valid(); iter.Next() { + rawData := iter.Value() + logDebug("GetAllTracesForBlock", "Raw trace data length=%d", len(rawData)) + + // Deserialize protobuf + var protoTrace ExecutionTraceProto + if err := proto.Unmarshal(rawData, &protoTrace); err != nil { + logError("EcallRecorder", "Failed to deserialize trace: %v", err) + continue + } + + trace := protoToExecutionTrace(&protoTrace) + + logDebug("GetAllTracesForBlock", "Deserialized trace index=%d callbackGas=%d gasUsed=%d ops=%d", + trace.Index, trace.CallbackGas, trace.GasUsed, len(trace.Ops)) + traces = append(traces, trace) + } + + return traces, nil +} + +// executionTraceToProto converts ExecutionTrace to ExecutionTraceProto +func executionTraceToProto(trace *ExecutionTrace) *ExecutionTraceProto { + ops := make([]*StorageOpProto, len(trace.Ops)) + for i, op := range trace.Ops { + ops[i] = &StorageOpProto{ + IsDelete: op.IsDelete, + Key: op.Key, + Value: op.Value, + } + } + crossOps := make([]*CrossModuleOpProto, len(trace.CrossOps)) + for i, cop := range trace.CrossOps { + crossOps[i] = &CrossModuleOpProto{ + StoreKey: cop.StoreKey, + Key: cop.Key, + Value: cop.Value, + IsDelete: cop.IsDelete, + } + } + return &ExecutionTraceProto{ + Index: trace.Index, + Ops: ops, + Result: trace.Result, + GasUsed: trace.GasUsed, + CallbackGas: trace.CallbackGas, + HasError: trace.HasError, + ErrorMsg: trace.ErrorMsg, + CrossOps: crossOps, + } +} + +// protoToExecutionTrace converts ExecutionTraceProto to ExecutionTrace +func protoToExecutionTrace(proto *ExecutionTraceProto) *ExecutionTrace { + ops := make([]StorageOp, len(proto.Ops)) + for i, op := range proto.Ops { + ops[i] = StorageOp{ + IsDelete: op.IsDelete, + Key: op.Key, + Value: op.Value, + } + } + crossOps := make([]CrossModuleOp, len(proto.CrossOps)) + for i, cop := range proto.CrossOps { + crossOps[i] = CrossModuleOp{ + StoreKey: cop.StoreKey, + Key: cop.Key, + Value: cop.Value, + IsDelete: cop.IsDelete, + } + } + return &ExecutionTrace{ + Index: proto.Index, + Ops: ops, + CrossOps: crossOps, + Result: proto.Result, + GasUsed: proto.GasUsed, + CallbackGas: proto.CallbackGas, + HasError: proto.HasError, + ErrorMsg: proto.ErrorMsg, + } +} + +// --- Utility functions --- + +// HasRecordForHeight checks if a record exists for a given height +func (r *EcallRecorder) HasRecordForHeight(height int64) bool { + if r.db == nil { + return false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeBlockKey(prefixSubmitBlockSignatures, height) + has, err := r.db.Has(key) + return err == nil && has +} + +// GetLatestRecordedHeight returns the highest recorded block height +func (r *EcallRecorder) GetLatestRecordedHeight() int64 { + if r.db == nil { + return 0 + } + + r.mu.RLock() + defer r.mu.RUnlock() + + // Iterate backwards to find the latest height + iter, err := r.db.ReverseIterator( + prefixSubmitBlockSignatures, + append(prefixSubmitBlockSignatures, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), + ) + if err != nil { + return 0 + } + defer iter.Close() + + if iter.Valid() { + key := iter.Key() + if len(key) == 9 { // prefix (1) + height (8) + return int64(binary.BigEndian.Uint64(key[1:])) + } + } + return 0 +} + +// DeleteRecordsBeforeHeight removes records older than the given height (for pruning) +func (r *EcallRecorder) DeleteRecordsBeforeHeight(height int64) error { + if r.db == nil { + return fmt.Errorf("database not initialized") + } + + r.mu.Lock() + defer r.mu.Unlock() + + batch := r.db.NewBatch() + defer batch.Close() + + count := 0 + + // Prune all height-keyed prefixes: block signatures, seeds, seed errors + for _, prefix := range [][]byte{prefixSubmitBlockSignatures, prefixGetEncryptedSeed, prefixGetEncryptedSeedErr} { + startKey := makeBlockKey(prefix, 0) + endKey := makeBlockKey(prefix, height) + + iter, err := r.db.Iterator(startKey, endKey) + if err != nil { + return err + } + + for ; iter.Valid(); iter.Next() { + if err := batch.Delete(iter.Key()); err != nil { + iter.Close() + return err + } + count++ + } + iter.Close() + } + + if err := batch.Write(); err != nil { + return err + } + + if count > 0 { + logInfo("EcallRecorder", "Pruned %d records before height %d", count, height) + } + return nil +} + +// PruneOldRecords runs pruning if conditions are met (every PruneIntervalBlocks) +func (r *EcallRecorder) PruneOldRecords(currentHeight int64) { + // Only prune in SGX mode (non-replay) + if r.IsReplayMode() { + return + } + + // Only prune every PruneIntervalBlocks + if currentHeight%PruneIntervalBlocks != 0 { + return + } + + // Calculate cutoff height + cutoffHeight := currentHeight - DefaultRetentionBlocks + if cutoffHeight <= 0 { + return + } + + // Run pruning in background to not block block processing + go func() { + if err := r.DeleteRecordsBeforeHeight(cutoffHeight); err != nil { + logError("EcallRecorder", "Pruning error: %v", err) + } + }() +} + +// --- Create result recording --- + +// CreateResult stores the outcome of an SGX Create call +type CreateResult struct { + CodeHash []byte // The hash returned by the enclave (empty on error) + HasError bool + ErrorMsg string +} + +// makeCreateResultKey creates a key: prefix | height (8 bytes) | wasmHash (32 bytes) +func makeCreateResultKey(height int64, wasmHash []byte) []byte { + key := make([]byte, len(prefixCreateResult)+8+len(wasmHash)) + copy(key, prefixCreateResult) + binary.BigEndian.PutUint64(key[len(prefixCreateResult):], uint64(height)) + copy(key[len(prefixCreateResult)+8:], wasmHash) + return key +} + +// RecordCreateResult records the result of an SGX Create call +func (r *EcallRecorder) RecordCreateResult(height int64, wasmHash []byte, codeHash []byte, errMsg string) error { + if r.db == nil { + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + result := &CreateResult{ + CodeHash: codeHash, + HasError: errMsg != "", + ErrorMsg: errMsg, + } + + // Simple encoding: hasError (1 byte) | errMsgLen (4 bytes) | errMsg | codeHash + var value []byte + if result.HasError { + errBytes := []byte(result.ErrorMsg) + value = make([]byte, 1+4+len(errBytes)) + value[0] = 1 + binary.BigEndian.PutUint32(value[1:5], uint32(len(errBytes))) + copy(value[5:], errBytes) + } else { + value = make([]byte, 1+len(codeHash)) + value[0] = 0 + copy(value[1:], codeHash) + } + + key := makeCreateResultKey(height, wasmHash) + if err := r.db.Set(key, value); err != nil { + return fmt.Errorf("failed to write Create result to db: %w", err) + } + + logInfo("EcallRecorder", "Recorded Create result for height %d, hasError=%v", height, result.HasError) + return nil +} + +// ReplayCreateResult retrieves the recorded Create result +func (r *EcallRecorder) ReplayCreateResult(height int64, wasmHash []byte) (codeHash []byte, errMsg string, found bool) { + if r.db == nil { + return nil, "", false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeCreateResultKey(height, wasmHash) + value, err := r.db.Get(key) + if err != nil || value == nil { + return nil, "", false + } + + if len(value) < 1 { + return nil, "", false + } + + hasError := value[0] == 1 + if hasError { + if len(value) < 5 { + return nil, "", false + } + errLen := binary.BigEndian.Uint32(value[1:5]) + if len(value) < 5+int(errLen) { + return nil, "", false + } + return nil, string(value[5 : 5+errLen]), true + } + + return value[1:], "", true +} + +// GetAllCreateResultsForBlock returns all Create results recorded for a given block height +func (r *EcallRecorder) GetAllCreateResultsForBlock(height int64) ([]*CreateResult, [][]byte, error) { + if r.db == nil { + return nil, nil, nil + } + + r.mu.RLock() + defer r.mu.RUnlock() + + // Build prefix for iteration: prefix | height + iterPrefix := make([]byte, len(prefixCreateResult)+8) + copy(iterPrefix, prefixCreateResult) + binary.BigEndian.PutUint64(iterPrefix[len(prefixCreateResult):], uint64(height)) + + var results []*CreateResult + var wasmHashes [][]byte + + // Build end key: increment the last byte of the height to get next height prefix + // IMPORTANT: Must copy to avoid mutating iterPrefix via shared backing array + iterEnd := make([]byte, len(iterPrefix)) + copy(iterEnd, iterPrefix) + iterEnd[len(iterEnd)-1]++ + + iter, err := r.db.Iterator(iterPrefix, iterEnd) + if err != nil { + return nil, nil, fmt.Errorf("failed to create iterator: %w", err) + } + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + key := iter.Key() + value := iter.Value() + + // Extract wasmHash from key (after prefix + height) + wasmHash := key[len(prefixCreateResult)+8:] + wasmHashCopy := make([]byte, len(wasmHash)) + copy(wasmHashCopy, wasmHash) + wasmHashes = append(wasmHashes, wasmHashCopy) + + result := &CreateResult{} + if len(value) >= 1 && value[0] == 1 { + result.HasError = true + if len(value) >= 5 { + errLen := binary.BigEndian.Uint32(value[1:5]) + if len(value) >= 5+int(errLen) { + result.ErrorMsg = string(value[5 : 5+errLen]) + } + } + } else if len(value) >= 1 { + result.CodeHash = make([]byte, len(value)-1) + copy(result.CodeHash, value[1:]) + } + results = append(results, result) + } + + return results, wasmHashes, nil +} diff --git a/go-cosmwasm/api/ecall_record_stub.go b/go-cosmwasm/api/ecall_record_stub.go new file mode 100644 index 0000000000..b0f5b90ed4 --- /dev/null +++ b/go-cosmwasm/api/ecall_record_stub.go @@ -0,0 +1,145 @@ +//go:build secretcli +// +build secretcli + +package api + +// Stub implementations for secretcli builds (no SGX support) + +type NodeMode string + +const ( + NodeModeSGX NodeMode = "sgx" + NodeModeReplay NodeMode = "replay" +) + +// StorageOp represents a single storage operation (Set or Delete) +type StorageOp struct { + Key []byte + Value []byte + IsDelete bool +} + +// CrossModuleOp represents a write to a module store other than the contract's own prefixed store. +type CrossModuleOp struct { + StoreKey string + Key []byte + Value []byte + IsDelete bool +} + +// ExecutionTrace stores all storage operations from a contract execution +type ExecutionTrace struct { + Index int64 + Ops []StorageOp + CrossOps []CrossModuleOp + Result []byte + GasUsed uint64 + CallbackGas uint64 + HasError bool + IsOutOfGas bool + ErrorMsg string +} + +// EcallRecorder stub for secretcli +type EcallRecorder struct { + mode NodeMode +} + +var globalRecorder *EcallRecorder + +// GetRecorder returns a stub recorder for secretcli builds +func GetRecorder() *EcallRecorder { + if globalRecorder == nil { + globalRecorder = &EcallRecorder{mode: NodeModeSGX} + } + return globalRecorder +} + +func (r *EcallRecorder) Mode() NodeMode { return r.mode } +func (r *EcallRecorder) IsSGXMode() bool { return r.mode == NodeModeSGX } +func (r *EcallRecorder) IsReplayMode() bool { return r.mode == NodeModeReplay } +func (r *EcallRecorder) Close() error { return nil } +func (r *EcallRecorder) PruneOldRecords(int64) {} + +func (r *EcallRecorder) RecordSubmitBlockSignatures(height int64, random []byte, evidence []byte) error { + return nil +} + +func (r *EcallRecorder) ReplaySubmitBlockSignatures(height int64) (random []byte, evidence []byte, found bool) { + return nil, nil, false +} + +func (r *EcallRecorder) HasRecordForHeight(height int64) bool { + return false +} + +func (r *EcallRecorder) GetLatestRecordedHeight() int64 { + return 0 +} + +func (r *EcallRecorder) DeleteRecordsBeforeHeight(height int64) error { + return nil +} + +func (r *EcallRecorder) RecordGetEncryptedSeed(height int64, certHash []byte, output []byte) error { + return nil +} + +func (r *EcallRecorder) RecordGetEncryptedSeedError(height int64, certHash []byte, errMsg string) error { + return nil +} + +func (r *EcallRecorder) ReplayGetEncryptedSeed(height int64, certHash []byte) (output []byte, errMsg string, found bool) { + return nil, "", false +} + +func (r *EcallRecorder) RecordMachineIDProof(height int64, machineID []byte, proof []byte) error { + return nil +} + +func (r *EcallRecorder) ReplayMachineIDProof(height int64, machineID []byte) (proof []byte, found bool) { + return nil, false +} + +func (r *EcallRecorder) RecordExecutionTrace(height int64, index int64, trace *ExecutionTrace) error { + return nil +} + +func (r *EcallRecorder) ReplayExecutionTrace(height int64, index int64) (*ExecutionTrace, bool) { + return nil, false +} + +func (r *EcallRecorder) GetAllTracesForBlock(height int64) ([]*ExecutionTrace, error) { + return nil, nil +} + +// Block-scoped execution tracking stubs +func (r *EcallRecorder) StartBlock(height int64) {} +func (r *EcallRecorder) NextExecutionIndex() int64 { return 0 } +func (r *EcallRecorder) GetCurrentBlockHeight() int64 { return 0 } +func (r *EcallRecorder) SetBlockTraces(traces []*ExecutionTrace) {} +func (r *EcallRecorder) GetTraceFromMemory(index int64) (*ExecutionTrace, bool) { return nil, false } + +// Cross-module ops stubs +func (r *EcallRecorder) SetPendingCrossModuleOps(ops []CrossModuleOp) {} +func (r *EcallRecorder) AppendCrossModuleOp(op CrossModuleOp) {} +func (r *EcallRecorder) GetAndClearPendingCrossModuleOps() []CrossModuleOp { return nil } + +// CreateResult stores the outcome of an SGX Create call +type CreateResult struct { + CodeHash []byte + HasError bool + ErrorMsg string +} + +// Create result recording stubs +func (r *EcallRecorder) RecordCreateResult(height int64, wasmHash []byte, codeHash []byte, errMsg string) error { + return nil +} +func (r *EcallRecorder) ReplayCreateResult(height int64, wasmHash []byte) (codeHash []byte, errMsg string, found bool) { + return nil, "", false +} +func (r *EcallRecorder) GetAllCreateResultsForBlock(height int64) ([]*CreateResult, [][]byte, error) { + return nil, nil, nil +} + diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index 68909df7ec..0728dc365c 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -1,5 +1,5 @@ -//go:build !secretcli -// +build !secretcli +//go:build !secretcli && !nosgx +// +build !secretcli,!nosgx package api @@ -8,6 +8,8 @@ package api import "C" import ( + "crypto/sha256" + "encoding/hex" "errors" "fmt" "runtime" @@ -38,6 +40,10 @@ type Cache struct { } func HealthCheck() ([]byte, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + return []byte("replay"), nil + } errmsg := C.Buffer{} res, err := C.get_health_check(&errmsg) @@ -47,7 +53,11 @@ func HealthCheck() ([]byte, error) { return receiveVector(res), nil } -func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom []byte /* valSet []byte, nextValSet []byte */) ([]byte, []byte, error) { +func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom []byte, cronMsgs []byte /* valSet []byte, nextValSet []byte */) ([]byte, []byte, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + return nil, nil, errors.New("submit block signatures not supported on non-SGX node") + } errmsg := C.Buffer{} spidSlice := sendSlice(header) defer freeAfterSend(spidSlice) @@ -66,6 +76,11 @@ func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom [ } func SubmitValidatorSetEvidence(evidence []byte) error { + recorder := GetRecorder() + if recorder.IsReplayMode() { + logInfo("SubmitValidatorSetEvidence", "Skipped in replay mode") + return nil + } errmsg := C.Buffer{} evidenceSlice := sendSlice(evidence) defer freeAfterSend(evidenceSlice) @@ -74,6 +89,14 @@ func SubmitValidatorSetEvidence(evidence []byte) error { } func InitBootstrap() ([]byte, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + // In replay mode, return a dummy 32-byte public key + // This function is only called during bootstrap which doesn't happen in replay + logInfo("InitBootstrap", "Skipped in replay mode") + return make([]byte, 32), nil + } + errmsg := C.Buffer{} res, err := C.init_bootstrap(&errmsg) if err != nil { @@ -83,6 +106,13 @@ func InitBootstrap() ([]byte, error) { } func LoadSeedToEnclave(masterKey []byte, seed []byte) (bool, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + // In replay mode, skip loading seed to enclave (no enclave) + logInfo("LoadSeedToEnclave", "Skipped in replay mode") + return true, nil + } + pkSlice := sendSlice(masterKey) defer freeAfterSend(pkSlice) seedSlice := sendSlice(seed) @@ -97,6 +127,11 @@ func LoadSeedToEnclave(masterKey []byte, seed []byte) (bool, error) { } func RotateStore(kvs []byte) (bool, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + logInfo("RotateStore", "Skipped in replay mode") + return false, errors.New("rotate store not supported on non-SGX node") + } // avoid buffer copy. We need modification in-place kvSlice := C.Buffer{ ptr: (*C.uint8_t)(unsafe.Pointer(&kvs[0])), @@ -115,6 +150,11 @@ func RotateStore(kvs []byte) (bool, error) { } func MigrationOp(op uint32) (bool, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + logInfo("MigrationOp", "Skipped in replay mode") + return true, nil // no-op success so upgrade handlers don't fail + } ret, err := C.migration_op(u32(op)) if err != nil { return false, err @@ -125,12 +165,11 @@ func MigrationOp(op uint32) (bool, error) { return true, nil } -func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { - res := C.get_network_pubkey(u32(i_seed)) - return receiveVector(res.buf1), receiveVector(res.buf2) -} - func EmergencyApproveUpgrade(nodeDir string, msg string) (bool, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + return false, errors.New("emergency approve upgrade not supported on non-SGX node") + } nodeDirBuf := sendSlice([]byte(nodeDir)) defer freeAfterSend(nodeDirBuf) @@ -168,6 +207,13 @@ func ReleaseCache(cache Cache) { } func InitEnclaveRuntime(moduleCacheSize uint16) error { + recorder := GetRecorder() + if recorder.IsReplayMode() { + // In replay mode, skip enclave runtime initialization (no enclave) + logInfo("InitEnclaveRuntime", "Skipped in replay mode") + return nil + } + errmsg := C.Buffer{} config := C.EnclaveRuntimeConfig{ @@ -182,6 +228,11 @@ func InitEnclaveRuntime(moduleCacheSize uint16) error { } func OnUpgradeProposalPassed(mrEnclaveHash []byte) error { + recorder := GetRecorder() + if recorder.IsReplayMode() { + logInfo("OnUpgradeProposalPassed", "Skipped in replay mode") + return nil + } msgBuf := sendSlice(mrEnclaveHash) defer freeAfterSend(msgBuf) @@ -233,10 +284,27 @@ func Create(cache Cache, wasm []byte) ([]byte, error) { defer freeAfterSend(code) errmsg := C.Buffer{} id, err := C.create(cache.ptr, code, &errmsg) + + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + if err != nil { - return nil, errorWithMessage(err, errmsg) - } - return receiveVector(id), nil + createErr := errorWithMessage(err, errmsg) + // Record the failure so non-SGX nodes can replay it + wasmHash := sha256.Sum256(wasm) + if recErr := recorder.RecordCreateResult(height, wasmHash[:], nil, createErr.Error()); recErr != nil { + logError("Create", "Failed to record Create error: %v", recErr) + } + return nil, createErr + } + + codeHash := receiveVector(id) + // Record the success + wasmHash := sha256.Sum256(wasm) + if recErr := recorder.RecordCreateResult(height, wasmHash[:], codeHash, ""); recErr != nil { + logError("Create", "Failed to record Create result: %v", recErr) + } + return codeHash, nil } func GetCode(cache Cache, code_id []byte) ([]byte, error) { @@ -264,6 +332,25 @@ func Migrate( admin []byte, adminProof []byte, ) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + if recorder.IsReplayMode() { + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + return result, gas, err + } + return nil, 0, fmt.Errorf("Migrate replay failed: trace not found for height %d index %d", height, execIndex) + } + + recording := recorder.IsSGXMode() + var recordingStore *RecordingKVStore + var storeForDB KVStore = store + if recording { + recordingStore = NewRecordingKVStore(store) + storeForDB = recordingStore + } + id := sendSlice(code_id) defer freeAfterSend(id) p := sendSlice(params) @@ -275,7 +362,7 @@ func Migrate( counter := startContract() defer endContract(counter) - dbState := buildDBState(store, counter) + dbState := buildDBState(storeForDB, counter) db := buildDB(&dbState, gasMeter) s := sendSlice(sigInfo) @@ -291,17 +378,62 @@ func Migrate( adminProofBuffer := sendSlice(adminProof) defer freeAfterSend(adminProofBuffer) - //// This is done in order to ensure that goroutines don't - //// swap threads between recursive calls to the enclave. - //runtime.LockOSThread() - //defer runtime.UnlockOSThread() + // Capture gas before execution to measure callback gas + var gasBefore uint64 + if recording && gasMeter != nil { + gasBefore = (*gasMeter).GasConsumed() + } res, err := C.migrate(cache.ptr, id, p, m, db, a, q, u64(gasLimit), &gasUsed, &errmsg, s, adminBuffer, adminProofBuffer) - if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { - // Depending on the nature of the error, `gasUsed` will either have a meaningful value, or just 0. - return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + + if !recording { + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + } + return receiveVector(res), uint64(gasUsed), nil } - return receiveVector(res), uint64(gasUsed), nil + + // Calculate callback gas consumed during execution + var callbackGas uint64 + if gasMeter != nil { + gasAfter := (*gasMeter).GasConsumed() + callbackGas = gasAfter - gasBefore + } + + // Record the execution trace + trace := &ExecutionTrace{ + Index: execIndex, + Ops: recordingStore.GetOps(), + CrossOps: recorder.GetAndClearPendingCrossModuleOps(), + GasUsed: uint64(gasUsed), + CallbackGas: callbackGas, + } + + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + trace.HasError = true + errorMsgBytes := receiveVector(errmsg) + trace.ErrorMsg = string(errorMsgBytes) + if errno, ok := err.(syscall.Errno); ok && int(errno) == 2 { + trace.IsOutOfGas = true + } + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Migrate", "Failed to record trace: %v", recordErr) + } + if trace.IsOutOfGas { + return nil, uint64(gasUsed), types.OutOfGasError{} + } + if errorMsgBytes == nil { + return nil, uint64(gasUsed), err + } + return nil, uint64(gasUsed), fmt.Errorf("%s", string(errorMsgBytes)) + } + + trace.Result = receiveVector(res) + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Migrate", "Failed to record trace: %v", recordErr) + } + + return trace.Result, uint64(gasUsed), nil } func UpdateAdmin( @@ -318,16 +450,34 @@ func UpdateAdmin( currentAdminProof []byte, newAdmin []byte, ) ([]byte, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + if recorder.IsReplayMode() { + if result, _, err, found := replayExecution(store, gasMeter, execIndex); found { + return result, err + } + return nil, fmt.Errorf("UpdateAdmin replay failed: trace not found for height %d index %d", height, execIndex) + } + + recording := recorder.IsSGXMode() + var recordingStore *RecordingKVStore + var storeForDB KVStore = store + if recording { + recordingStore = NewRecordingKVStore(store) + storeForDB = recordingStore + } + id := sendSlice(code_id) defer freeAfterSend(id) p := sendSlice(params) defer freeAfterSend(p) - // set up a new stack frame to handle iterators counter := startContract() defer endContract(counter) - dbState := buildDBState(store, counter) + dbState := buildDBState(storeForDB, counter) db := buildDB(&dbState, gasMeter) s := sendSlice(sigInfo) @@ -345,16 +495,61 @@ func UpdateAdmin( newAdminBuffer := sendSlice(newAdmin) defer freeAfterSend(newAdminBuffer) - //// This is done in order to ensure that goroutines don't - //// swap threads between recursive calls to the enclave. - //runtime.LockOSThread() - //defer runtime.UnlockOSThread() + var gasBefore uint64 + if recording && gasMeter != nil { + gasBefore = (*gasMeter).GasConsumed() + } res, err := C.update_admin(cache.ptr, id, p, db, a, q, u64(gasLimit), &errmsg, s, currentAdminBuffer, currentAdminProofBuffer, newAdminBuffer) - if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { - return nil, errorWithMessage(err, errmsg) + + if !recording { + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + return nil, errorWithMessage(err, errmsg) + } + return receiveVector(res), nil } - return receiveVector(res), nil + + // Calculate callback gas consumed during execution + var callbackGas uint64 + if gasMeter != nil { + gasAfter := (*gasMeter).GasConsumed() + callbackGas = gasAfter - gasBefore + } + + // Record the execution trace + trace := &ExecutionTrace{ + Index: execIndex, + Ops: recordingStore.GetOps(), + CrossOps: recorder.GetAndClearPendingCrossModuleOps(), + GasUsed: 0, // UpdateAdmin doesn't return gas used + CallbackGas: callbackGas, + } + + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + trace.HasError = true + errorMsgBytes := receiveVector(errmsg) + trace.ErrorMsg = string(errorMsgBytes) + if errno, ok := err.(syscall.Errno); ok && int(errno) == 2 { + trace.IsOutOfGas = true + } + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("UpdateAdmin", "Failed to record trace: %v", recordErr) + } + if trace.IsOutOfGas { + return nil, types.OutOfGasError{} + } + if errorMsgBytes == nil { + return nil, err + } + return nil, fmt.Errorf("%s", string(errorMsgBytes)) + } + + trace.Result = receiveVector(res) + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("UpdateAdmin", "Failed to record trace: %v", recordErr) + } + + return trace.Result, nil } func Instantiate( @@ -370,6 +565,28 @@ func Instantiate( sigInfo []byte, admin []byte, ) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + if recorder.IsReplayMode() { + logDebug("Instantiate", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("Instantiate", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, gas, err + } + logWarn("Instantiate", "REPLAY FAILED: trace not found!") + return nil, 0, fmt.Errorf("Instantiate replay failed: trace not found for height %d index %d", height, execIndex) + } + + recording := recorder.IsSGXMode() + var recordingStore *RecordingKVStore + var storeForDB KVStore = store + if recording { + recordingStore = NewRecordingKVStore(store) + storeForDB = recordingStore + } + id := sendSlice(code_id) defer freeAfterSend(id) p := sendSlice(params) @@ -381,7 +598,7 @@ func Instantiate( counter := startContract() defer endContract(counter) - dbState := buildDBState(store, counter) + dbState := buildDBState(storeForDB, counter) db := buildDB(&dbState, gasMeter) s := sendSlice(sigInfo) @@ -394,17 +611,71 @@ func Instantiate( adminBuffer := sendSlice(admin) defer freeAfterSend(adminBuffer) - //// This is done in order to ensure that goroutines don't - //// swap threads between recursive calls to the enclave. - //runtime.LockOSThread() - //defer runtime.UnlockOSThread() + // Capture gas before execution to measure callback gas + var gasBefore uint64 + if recording && gasMeter != nil { + gasBefore = (*gasMeter).GasConsumed() + logDebug("Instantiate", "SGX gasBefore=%d", gasBefore) + } res, err := C.instantiate(cache.ptr, id, p, m, db, a, q, u64(gasLimit), &gasUsed, &errmsg, s, adminBuffer) - if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { - // Depending on the nature of the error, `gasUsed` will either have a meaningful value, or just 0. - return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + + if !recording { + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + } + return receiveVector(res), uint64(gasUsed), nil } - return receiveVector(res), uint64(gasUsed), nil + + // Calculate callback gas consumed during execution + var callbackGas uint64 + if gasMeter != nil { + gasAfter := (*gasMeter).GasConsumed() + callbackGas = gasAfter - gasBefore + logDebug("Instantiate", "SGX gasAfter=%d callbackGas=%d (gasAfter - gasBefore)", gasAfter, callbackGas) + } else { + logWarn("Instantiate", "SGX WARNING: gasMeter is nil, cannot measure callbackGas") + } + + logDebug("Instantiate", "SGX C.instantiate returned: gasUsed=%d callbackGas=%d", gasUsed, callbackGas) + + // Record the execution trace + trace := &ExecutionTrace{ + Index: execIndex, + Ops: recordingStore.GetOps(), + CrossOps: recorder.GetAndClearPendingCrossModuleOps(), + GasUsed: uint64(gasUsed), + CallbackGas: callbackGas, + } + + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + trace.HasError = true + errorMsgBytes := receiveVector(errmsg) + trace.ErrorMsg = string(errorMsgBytes) + if errno, ok := err.(syscall.Errno); ok && int(errno) == 2 { + trace.IsOutOfGas = true + } + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Instantiate", "Failed to record trace: %v", recordErr) + } + if trace.IsOutOfGas { + return nil, uint64(gasUsed), types.OutOfGasError{} + } + if errorMsgBytes == nil { + return nil, uint64(gasUsed), err + } + return nil, uint64(gasUsed), fmt.Errorf("%s", string(errorMsgBytes)) + } + + trace.Result = receiveVector(res) + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Instantiate", "Failed to record trace: %v", recordErr) + } else { + logDebug("Instantiate", "SGX recorded trace: height=%d index=%d ops=%d resultLen=%d gasUsed=%d callbackGas=%d", + height, execIndex, len(trace.Ops), len(trace.Result), trace.GasUsed, trace.CallbackGas) + } + + return trace.Result, uint64(gasUsed), nil } func Handle( @@ -420,6 +691,28 @@ func Handle( sigInfo []byte, handleType types.HandleType, ) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + if recorder.IsReplayMode() { + logDebug("Handle", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("Handle", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, gas, err + } + logWarn("Handle", "REPLAY FAILED: trace not found!") + return nil, 0, fmt.Errorf("Handle replay failed: trace not found for height %d index %d", height, execIndex) + } + + recording := recorder.IsSGXMode() + var recordingStore *RecordingKVStore + var storeForDB KVStore = store + if recording { + recordingStore = NewRecordingKVStore(store) + storeForDB = recordingStore + } + id := sendSlice(code_id) defer freeAfterSend(id) p := sendSlice(params) @@ -431,7 +724,7 @@ func Handle( counter := startContract() defer endContract(counter) - dbState := buildDBState(store, counter) + dbState := buildDBState(storeForDB, counter) db := buildDB(&dbState, gasMeter) s := sendSlice(sigInfo) defer freeAfterSend(s) @@ -440,17 +733,71 @@ func Handle( var gasUsed u64 errmsg := C.Buffer{} - //// This is done in order to ensure that goroutines don't - //// swap threads between recursive calls to the enclave. - //runtime.LockOSThread() - //defer runtime.UnlockOSThread() + // Capture gas before execution to measure callback gas + var gasBefore uint64 + if recording && gasMeter != nil { + gasBefore = (*gasMeter).GasConsumed() + logDebug("Handle", "SGX gasBefore=%d", gasBefore) + } res, err := C.handle(cache.ptr, id, p, m, db, a, q, u64(gasLimit), &gasUsed, &errmsg, s, u8(handleType)) - if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { - // Depending on the nature of the error, `gasUsed` will either have a meaningful value, or just 0. - return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + + if !recording { + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + return nil, uint64(gasUsed), errorWithMessage(err, errmsg) + } + return receiveVector(res), uint64(gasUsed), nil } - return receiveVector(res), uint64(gasUsed), nil + + // Calculate callback gas consumed during execution + var callbackGas uint64 + if gasMeter != nil { + gasAfter := (*gasMeter).GasConsumed() + callbackGas = gasAfter - gasBefore + logDebug("Handle", "SGX gasAfter=%d callbackGas=%d (gasAfter - gasBefore)", gasAfter, callbackGas) + } else { + logWarn("Handle", "SGX WARNING: gasMeter is nil, cannot measure callbackGas") + } + + logDebug("Handle", "SGX C.handle returned: gasUsed=%d callbackGas=%d", gasUsed, callbackGas) + + // Record the execution trace + trace := &ExecutionTrace{ + Index: execIndex, + Ops: recordingStore.GetOps(), + CrossOps: recorder.GetAndClearPendingCrossModuleOps(), + GasUsed: uint64(gasUsed), + CallbackGas: callbackGas, + } + + if err != nil && err.(syscall.Errno) != C.ErrnoValue_Success { + trace.HasError = true + errorMsgBytes := receiveVector(errmsg) + trace.ErrorMsg = string(errorMsgBytes) + if errno, ok := err.(syscall.Errno); ok && int(errno) == 2 { + trace.IsOutOfGas = true + } + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Handle", "Failed to record trace: %v", recordErr) + } + if trace.IsOutOfGas { + return nil, uint64(gasUsed), types.OutOfGasError{} + } + if errorMsgBytes == nil { + return nil, uint64(gasUsed), err + } + return nil, uint64(gasUsed), fmt.Errorf("%s", string(errorMsgBytes)) + } + + trace.Result = receiveVector(res) + if recordErr := recorder.RecordExecutionTrace(height, execIndex, trace); recordErr != nil { + logError("Handle", "Failed to record trace: %v", recordErr) + } else { + logDebug("Handle", "SGX recorded trace: height=%d index=%d ops=%d resultLen=%d gasUsed=%d callbackGas=%d", + height, execIndex, len(trace.Ops), len(trace.Result), trace.GasUsed, trace.CallbackGas) + } + + return trace.Result, uint64(gasUsed), nil } func Query( @@ -464,6 +811,10 @@ func Query( querier *Querier, gasLimit uint64, ) ([]byte, uint64, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + return nil, 0, errors.New("secret contract query not supported on non-SGX node") + } id := sendSlice(code_id) defer freeAfterSend(id) p := sendSlice(params) @@ -515,6 +866,14 @@ func AnalyzeCode( // KeyGen Send KeyGen request to enclave func KeyGen() ([]byte, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + // In replay mode, return a dummy 32-byte public key + // Key generation is only needed for node registration which doesn't happen in replay + logInfo("KeyGen", "Skipped in replay mode, returning dummy key") + return make([]byte, 32), nil + } + errmsg := C.Buffer{} res, err := C.key_gen(&errmsg) if err != nil { @@ -523,8 +882,16 @@ func KeyGen() ([]byte, error) { return receiveVector(res), nil } -// CreateAttestationReport Send request to enclave func CreateAttestationReport(ext_sk []byte, is_migration_report bool) (bool, error) { +// CreateAttestationReport Send CreateAttestationReport request to enclave +func CreateAttestationReport(no_epid bool, no_dcap bool, is_migration_report bool) (bool, error) { + recorder := GetRecorder() + if recorder.IsReplayMode() { + // In replay mode, skip attestation report creation (no SGX) + logInfo("CreateAttestationReport", "Skipped in replay mode") + return true, nil + } + errmsg := C.Buffer{} flags := u32(0) @@ -543,6 +910,39 @@ func CreateAttestationReport(ext_sk []byte, is_migration_report bool) (bool, err } func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, error) { + recorder := GetRecorder() + certHash := sha256.Sum256(cert) + certHashHex := hex.EncodeToString(certHash[:]) + + logInfo("GetEncryptedSeed", "SGX called: certHashHex=%s certLen=%d replayMode=%v", + certHashHex, len(cert), recorder.IsReplayMode()) + + if recorder.IsReplayMode() { + // Try local DB first + height := recorder.GetCurrentBlockHeight() + if output, errMsg, found := recorder.ReplayGetEncryptedSeed(height, certHash[:]); found { + if errMsg != "" { + // Replay the exact same error the SGX enclave produced + return nil, fmt.Errorf("%s", errMsg) + } + return output, nil + } + + // Fetch from remote SGX node + client := GetEcallClient() + output, err := client.FetchEncryptedSeed(height, certHashHex) + if err != nil { + return nil, fmt.Errorf("GetEncryptedSeed replay failed: %w", err) + } + + // Cache locally + if cacheErr := recorder.RecordGetEncryptedSeed(height, certHash[:], output); cacheErr != nil { + logError("GetEncryptedSeed", "Failed to cache: %v", cacheErr) + } + return output, nil + } + + // SGX mode: call enclave and record result errmsg := C.Buffer{} certSlice := sendSlice(cert) defer freeAfterSend(certSlice) @@ -550,12 +950,34 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e defer freeAfterSend(replace_machine_slice) res, err := C.get_encrypted_seed(certSlice, replace_machine_slice, &errmsg) if err != nil { - return nil, nil, errorWithMessage(err, errmsg) - } - return receiveVector(res.buf1), receiveVector(res.buf2), nil + enclaveErr := errorWithMessage(err, errmsg) + logInfo("GetEncryptedSeed", "SGX enclave FAILED for %s: %v", certHashHex, enclaveErr) + // Record the error so non-SGX nodes can replay the exact same message + height := recorder.GetCurrentBlockHeight() + if recErr := recorder.RecordGetEncryptedSeedError(height, certHash[:], enclaveErr.Error()); recErr != nil { + logError("GetEncryptedSeed", "Failed to record error: %v", recErr) + } + return nil, enclaveErr + } + + output := receiveVector(res) + height := recorder.GetCurrentBlockHeight() + logInfo("GetEncryptedSeed", "SGX enclave SUCCESS for %s (%d bytes), recording at height %d...", certHashHex, len(output), height) + if err := recorder.RecordGetEncryptedSeed(height, certHash[:], output); err != nil { + logError("GetEncryptedSeed", "Failed to record: %v", err) + } else { + logInfo("GetEncryptedSeed", "Recorded GetEncryptedSeed for %s OK", certHashHex) + } + return output, nil } func GetEncryptedGenesisSeed(pk []byte) ([]byte, error) { + // Genesis seed is only used during bootstrap of a new network. + // Non-SGX replay nodes don't need this - they sync from existing networks. + recorder := GetRecorder() + if recorder.IsReplayMode() { + return nil, errors.New("get encrypted genesis seed not supported on non-SGX node") + } errmsg := C.Buffer{} pkSlice := sendSlice(pk) defer freeAfterSend(pkSlice) diff --git a/go-cosmwasm/api/lib_nosgx.go b/go-cosmwasm/api/lib_nosgx.go new file mode 100644 index 0000000000..a0a0c38369 --- /dev/null +++ b/go-cosmwasm/api/lib_nosgx.go @@ -0,0 +1,425 @@ +//go:build !secretcli && nosgx + +package api + +import ( + "bytes" + "crypto/sha256" + "encoding/hex" + "errors" + "fmt" + "time" + + "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types" + v1types "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types/v1" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type Cache struct{} + +func HealthCheck() ([]byte, error) { + return []byte("replay"), nil +} + +func InitBootstrap(spid []byte, apiKey []byte) ([]byte, error) { + return nil, nil +} + +func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom []byte, cronMsgs []byte) ([]byte, []byte, error) { + return nil, nil, errors.New("submit block signatures not supported on non-SGX node") +} + +func SubmitValidatorSetEvidence(evidence []byte) error { + logInfo("SubmitValidatorSetEvidence", "Skipped in replay mode") + return nil +} + +func LoadSeedToEnclave(masterKey []byte, seed []byte, apiKey []byte) (bool, error) { + return true, nil +} + +type Querier = types.Querier + +func MigrationOp(op uint32) (bool, error) { + logInfo("MigrationOp", "Skipped in replay mode") + return true, nil // no-op success so upgrade handlers don't fail +} + +func RotateStore(kvs []byte) (bool, error) { + return false, errors.New("RotateStore not supported on non-SGX node") +} + +func EmergencyApproveUpgrade(nodeDir string, msg string) (bool, error) { + return false, errors.New("EmergencyApproveUpgrade not supported on non-SGX node") +} + +func InitCache(dataDir string, supportedFeatures string, cacheSize uint64) (Cache, error) { + return Cache{}, nil +} + +func ReleaseCache(cache Cache) { +} + +func InitEnclaveRuntime(ModuleCacheSize uint16) error { + return nil +} + +func Create(cache Cache, wasm []byte) ([]byte, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + wasmHash := sha256.Sum256(wasm) + + // Attempt to replay recorded Create result from SGX node + if recorder.IsReplayMode() { + codeHash, errMsg, found := recorder.ReplayCreateResult(height, wasmHash[:]) + if found { + if errMsg != "" { + return nil, fmt.Errorf("%s", errMsg) + } + return codeHash, nil + } + + // Not found locally — fetch all Create results for this block from remote SGX node + client := GetEcallClient() + retryDelay := 2 * time.Second + attempt := 0 + + for { + if client != nil && client.IsConnected() { + results, wasmHashes, err := client.FetchBlockCreateResults(height) + if err == nil && len(results) > 0 { + // Match wasmHash directly from fetched results (no DB round-trip needed) + for i, fetchedHash := range wasmHashes { + if bytes.Equal(fetchedHash, wasmHash[:]) { + r := results[i] + logInfo("Create", "Matched Create result from SGX node: height=%d hasError=%v (attempt %d)", height, r.HasError, attempt+1) + if r.HasError { + return nil, fmt.Errorf("%s", r.ErrorMsg) + } + return r.CodeHash, nil + } + } + } + } + + attempt++ + if attempt%15 == 1 { // Log every ~30 seconds + logWarn("Create", "Waiting for SGX node Create result: height=%d wasmHash=%x attempt=%d", height, wasmHash[:8], attempt) + } + time.Sleep(retryDelay) + } + } + + // Non-replay mode (e.g. secretcli): no enclave available, use sha256 of wasm + return wasmHash[:], nil +} + +func GetCode(cache Cache, code_id []byte) ([]byte, error) { + return nil, errors.New("GetCode is not supported on non-SGX node") +} + +func Migrate( + cache Cache, + code_id []byte, + params []byte, + msg []byte, + gasMeter *GasMeter, + store KVStore, + api *GoAPI, + querier *Querier, + gasLimit uint64, + sigInfo []byte, + admin []byte, + adminProof []byte, +) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + logDebug("Migrate", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("Migrate", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, gas, err + } + logWarn("Migrate", "REPLAY FAILED: trace not found!") + return nil, 0, fmt.Errorf("Migrate replay failed: trace not found for height %d index %d", height, execIndex) +} + +func UpdateAdmin( + cache Cache, + code_id []byte, + params []byte, + gasMeter *GasMeter, + store KVStore, + api *GoAPI, + querier *Querier, + gasLimit uint64, + sigInfo []byte, + currentAdmin []byte, + currentAdminProof []byte, + newAdmin []byte, +) ([]byte, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + logDebug("UpdateAdmin", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("UpdateAdmin", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, err + } + logWarn("UpdateAdmin", "REPLAY FAILED: trace not found!") + return nil, fmt.Errorf("UpdateAdmin replay failed: trace not found for height %d index %d", height, execIndex) +} + +func Instantiate( + cache Cache, + code_id []byte, + params []byte, + msg []byte, + gasMeter *GasMeter, + store KVStore, + api *GoAPI, + querier *Querier, + gasLimit uint64, + sigInfo []byte, + admin []byte, +) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + logDebug("Instantiate", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("Instantiate", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, gas, err + } + logWarn("Instantiate", "REPLAY FAILED: trace not found!") + return nil, 0, fmt.Errorf("Instantiate replay failed: trace not found for height %d index %d", height, execIndex) +} + +func Handle( + cache Cache, + code_id []byte, + params []byte, + msg []byte, + gasMeter *GasMeter, + store KVStore, + api *GoAPI, + querier *Querier, + gasLimit uint64, + sigInfo []byte, + handleType types.HandleType, +) ([]byte, uint64, error) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + execIndex := recorder.NextExecutionIndex() + + logDebug("Handle", "REPLAY mode: height=%d execIndex=%d", height, execIndex) + if result, gas, err, found := replayExecution(store, gasMeter, execIndex); found { + logDebug("Handle", "REPLAY success: resultLen=%d gas=%d err=%v", len(result), gas, err) + return result, gas, err + } + logWarn("Handle", "REPLAY FAILED: trace not found!") + return nil, 0, fmt.Errorf("Handle replay failed: trace not found for height %d index %d", height, execIndex) +} + +func Query( + cache Cache, + code_id []byte, + params []byte, + msg []byte, + gasMeter *GasMeter, + store KVStore, + api *GoAPI, + querier *Querier, + gasLimit uint64, +) ([]byte, uint64, error) { + return nil, 0, errors.New("Query not supported on non-SGX node") +} + +func AnalyzeCode( + cache Cache, + codeHash []byte, +) (*v1types.AnalysisReport, error) { + // Fetch the AnalyzeCode result from the SGX node via gRPC. + // This is needed because non-SGX nodes don't have the enclave to analyze WASM bytecode, + // but must know whether a contract has IBC entry points to register the correct IBC port. + // This flag directly affects state (IBC port creation), so we MUST retry and fail loudly. + client := GetEcallClient() + maxRetries := 20 + retryDelay := 50 * time.Millisecond + maxDelay := 2 * time.Second + var lastErr error + + for attempt := 0; attempt < maxRetries; attempt++ { + hasIBC, features, err := client.FetchAnalyzeCode(codeHash) + if err == nil { + logDebug("AnalyzeCode", "Fetched AnalyzeCode for %s: hasIBC=%v features=%s", hex.EncodeToString(codeHash), hasIBC, features) + return &v1types.AnalysisReport{ + HasIBCEntryPoints: hasIBC, + RequiredFeatures: features, + }, nil + } + lastErr = err + if attempt < maxRetries-1 { + delay := retryDelay * time.Duration(1< maxDelay { + delay = maxDelay + } + time.Sleep(delay) + } + } + return nil, fmt.Errorf("AnalyzeCode: failed after %d retries for code hash %s: %v", maxRetries, hex.EncodeToString(codeHash), lastErr) +} + +func KeyGen() ([]byte, error) { + logInfo("KeyGen", "Skipped in replay mode, returning dummy key") + return make([]byte, 32), nil +} + +func CreateAttestationReport(no_epid bool, no_dcap bool, is_migration_report bool) (bool, error) { + logInfo("CreateAttestationReport", "Skipped in replay mode") + return true, nil +} + +func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { + return nil, nil +} + +func GetEncryptedSeed(cert []byte) ([]byte, error) { + recorder := GetRecorder() + certHash := sha256.Sum256(cert) + certHashHex := hex.EncodeToString(certHash[:]) + + logInfo("GetEncryptedSeed", "NON-SGX called: certHashHex=%s certLen=%d dbInitialized=%v", + certHashHex, len(cert), recorder != nil && recorder.db != nil) + + height := recorder.GetCurrentBlockHeight() + + // Try local DB first + if output, errMsg, found := recorder.ReplayGetEncryptedSeed(height, certHash[:]); found { + if errMsg != "" { + logInfo("GetEncryptedSeed", "Found CACHED ERROR in local DB for %s: %s", certHashHex, errMsg) + return nil, fmt.Errorf("%s", errMsg) + } + logInfo("GetEncryptedSeed", "Found CACHED SUCCESS in local DB for %s (%d bytes)", certHashHex, len(output)) + return output, nil + } + logInfo("GetEncryptedSeed", "NOT in local DB for %s, will fetch from SGX node via gRPC", certHashHex) + + // Fetch from remote SGX node with retries (the SGX node may still be + // processing the same block and recording the seed when we query) + client := GetEcallClient() + maxRetries := 20 + retryDelay := 50 * time.Millisecond + maxDelay := 2 * time.Second + + var lastErr error + for attempt := 0; attempt < maxRetries; attempt++ { + output, err := client.FetchEncryptedSeed(height, certHashHex) + if err == nil { + logInfo("GetEncryptedSeed", "Fetched seed from SGX node (attempt %d) for %s (%d bytes)", + attempt+1, certHashHex, len(output)) + // Cache locally + if cacheErr := recorder.RecordGetEncryptedSeed(height, certHash[:], output); cacheErr != nil { + logError("GetEncryptedSeed", "Failed to cache: %v", cacheErr) + } + return output, nil + } + + // Extract gRPC status for logging + grpcCode := "unknown" + grpcMsg := err.Error() + if st, ok := status.FromError(err); ok { + grpcCode = st.Code().String() + grpcMsg = st.Message() + } + + logInfo("GetEncryptedSeed", "gRPC attempt %d/%d for %s: code=%s msg=%s", + attempt+1, maxRetries, certHashHex, grpcCode, grpcMsg) + + // Check if this is a FailedPrecondition error (recorded error from SGX node) + if st, ok := status.FromError(err); ok && st.Code() == codes.FailedPrecondition { + // The SGX node recorded the enclave error - cache and replay it + enclaveErrMsg := st.Message() + logInfo("GetEncryptedSeed", "SGX node returned FailedPrecondition (enclave error) for %s: %s", + certHashHex, enclaveErrMsg) + if cacheErr := recorder.RecordGetEncryptedSeedError(height, certHash[:], enclaveErrMsg); cacheErr != nil { + logError("GetEncryptedSeed", "Failed to cache error: %v", cacheErr) + } + return nil, fmt.Errorf("%s", enclaveErrMsg) + } + + lastErr = err + + // For NotFound, the SGX node may not have recorded yet — retry + if st, ok := status.FromError(err); ok && st.Code() == codes.NotFound { + if attempt < maxRetries-1 { + time.Sleep(retryDelay) + retryDelay *= 2 + if retryDelay > maxDelay { + retryDelay = maxDelay + } + } + continue + } + + // For other errors (connection issues etc.), also retry + if attempt < maxRetries-1 { + time.Sleep(retryDelay) + retryDelay *= 2 + if retryDelay > maxDelay { + retryDelay = maxDelay + } + } + } + + logError("GetEncryptedSeed", "EXHAUSTED all %d retries for %s. lastErr: %v", maxRetries, certHashHex, lastErr) + return nil, fmt.Errorf("GetEncryptedSeed: failed after %d retries for cert hash %s: %v", maxRetries, certHashHex, lastErr) +} + +func GetEncryptedGenesisSeed(cert []byte) ([]byte, error) { + return nil, errors.New("GetEncryptedGenesisSeed not supported on non-SGX node") +} + +func OnUpgradeProposalPassed(mrEnclaveHash []byte) error { + return nil +} + +func OnApproveMachineID(machineID []byte, proof *[32]byte, is_on_chain bool) error { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + + // During node init (height=0), keeper loads stored proofs from state. + // On SGX nodes this loads them into the enclave; on non-SGX there's + // no enclave, so just skip — the proof already lives in the KV store. + if height == 0 { + logInfo("OnApproveMachineID", "Skipping at init (height=0, no enclave on non-SGX)") + return nil + } + + machineIDHex := fmt.Sprintf("%x", machineID) + + // Non-SGX nodes always fetch from the SGX node via gRPC + client := GetEcallClient() + retryDelay := 2 * time.Second + attempt := 0 + + for { + data, err := client.FetchMachineIDProof(height, machineIDHex) + if err == nil && len(data) > 0 { + logInfo("OnApproveMachineID", "Fetched proof from SGX node: height=%d (attempt %d)", height, attempt+1) + copy(proof[:], data) + return nil + } + + attempt++ + if attempt%15 == 1 { // Log every ~30 seconds + logWarn("OnApproveMachineID", "Waiting for SGX node proof: height=%d machineID=%s attempt=%d err=%v", height, machineIDHex, attempt, err) + } + time.Sleep(retryDelay) + } +} diff --git a/go-cosmwasm/api/link_muslc.go b/go-cosmwasm/api/link_muslc.go index b829c62d11..dc2ffe043c 100644 --- a/go-cosmwasm/api/link_muslc.go +++ b/go-cosmwasm/api/link_muslc.go @@ -1,5 +1,5 @@ -//go:build linux && muslc -// +build linux,muslc +//go:build linux && muslc && !nosgx +// +build linux,muslc,!nosgx package api diff --git a/go-cosmwasm/api/link_std.go b/go-cosmwasm/api/link_std.go index f01a64ecbd..9538b42ee7 100644 --- a/go-cosmwasm/api/link_std.go +++ b/go-cosmwasm/api/link_std.go @@ -1,5 +1,5 @@ -//go:build !secretcli && linux && !muslc && !darwin && sgx -// +build !secretcli,linux,!muslc,!darwin,sgx +//go:build !secretcli && linux && !muslc && !darwin && sgx && !nosgx +// +build !secretcli,linux,!muslc,!darwin,sgx,!nosgx package api diff --git a/go-cosmwasm/api/link_std_sw.go b/go-cosmwasm/api/link_std_sw.go index 0a60f6608f..d749c8ecf9 100644 --- a/go-cosmwasm/api/link_std_sw.go +++ b/go-cosmwasm/api/link_std_sw.go @@ -1,5 +1,5 @@ -//go:build !secretcli && linux && !muslc && !darwin && !sgx -// +build !secretcli,linux,!muslc,!darwin,!sgx +//go:build !secretcli && linux && !muslc && !darwin && !sgx && !nosgx +// +build !secretcli,linux,!muslc,!darwin,!sgx,!nosgx package api diff --git a/go-cosmwasm/api/logger.go b/go-cosmwasm/api/logger.go new file mode 100644 index 0000000000..492c793b24 --- /dev/null +++ b/go-cosmwasm/api/logger.go @@ -0,0 +1,92 @@ +package api + +import ( + "fmt" + "os" + "strings" + "sync" +) + +// LogLevel represents the logging level +type LogLevel int + +const ( + LogLevelError LogLevel = iota + LogLevelWarn + LogLevelInfo + LogLevelDebug +) + +var ( + globalLogger *logger + loggerOnce sync.Once + defaultLogLevel = LogLevelInfo + logLevelEnvVar = "LOG_LEVEL" +) + +type logger struct { + level LogLevel +} + +// getLogger returns the global logger instance +func getLogger() *logger { + loggerOnce.Do(func() { + level := parseLogLevel(os.Getenv(logLevelEnvVar)) + if level == -1 { + level = defaultLogLevel + } + globalLogger = &logger{level: level} + }) + return globalLogger +} + +// parseLogLevel parses a log level string (case-insensitive) +func parseLogLevel(s string) LogLevel { + s = strings.ToUpper(strings.TrimSpace(s)) + switch s { + case "ERROR": + return LogLevelError + case "WARN", "WARNING": + return LogLevelWarn + case "INFO": + return LogLevelInfo + case "DEBUG": + return LogLevelDebug + default: + return -1 + } +} + +// shouldLog returns true if the given level should be logged +func (l *logger) shouldLog(level LogLevel) bool { + return level <= l.level +} + +// logf formats and prints a log message if the level is enabled +func (l *logger) logf(level LogLevel, prefix, format string, args ...interface{}) { + if !l.shouldLog(level) { + return + } + msg := fmt.Sprintf(format, args...) + fmt.Printf("[%s] %s\n", prefix, msg) +} + +// Debug logs a debug message +func logDebug(prefix, format string, args ...interface{}) { + getLogger().logf(LogLevelDebug, prefix, format, args...) +} + +// Info logs an info message +func logInfo(prefix, format string, args ...interface{}) { + getLogger().logf(LogLevelInfo, prefix, format, args...) +} + +// Warn logs a warning message +func logWarn(prefix, format string, args ...interface{}) { + getLogger().logf(LogLevelWarn, prefix, format, args...) +} + +// Error logs an error message +func logError(prefix, format string, args ...interface{}) { + getLogger().logf(LogLevelError, prefix, format, args...) +} diff --git a/go-cosmwasm/api/memory.go b/go-cosmwasm/api/memory.go index 5e8be3012a..31f20a8c08 100644 --- a/go-cosmwasm/api/memory.go +++ b/go-cosmwasm/api/memory.go @@ -1,5 +1,5 @@ -//go:build !secretcli -// +build !secretcli +//go:build !secretcli && !nosgx +// +build !secretcli,!nosgx package api @@ -12,7 +12,7 @@ import "unsafe" func allocateRust(data []byte) C.Buffer { var ret C.Buffer - if data == nil { + if data == nil { // Just return a null buffer ret = C.Buffer{ ptr: u8_ptr(nil), diff --git a/go-cosmwasm/api/recording_store.go b/go-cosmwasm/api/recording_store.go new file mode 100644 index 0000000000..e9149d12e6 --- /dev/null +++ b/go-cosmwasm/api/recording_store.go @@ -0,0 +1,130 @@ +//go:build !secretcli +// +build !secretcli + +package api + +import ( + dbm "github.com/cosmos/cosmos-db" +) + +// StorageOp represents a single storage operation (Set or Delete) +type StorageOp struct { + Key []byte + Value []byte // nil for delete + IsDelete bool +} + +// RecordingKVStore wraps a KVStore and records all Set/Delete operations +type RecordingKVStore struct { + inner KVStore + ops []StorageOp +} + +// NewRecordingKVStore creates a new recording wrapper around a KVStore +func NewRecordingKVStore(inner KVStore) *RecordingKVStore { + return &RecordingKVStore{ + inner: inner, + ops: nil, + } +} + +// Get delegates to the inner store (no recording needed for state) +func (r *RecordingKVStore) Get(key []byte) []byte { + return r.inner.Get(key) +} + +// Set records the operation and delegates to the inner store +func (r *RecordingKVStore) Set(key, value []byte) { + // Copy key and value to avoid issues with reused buffers + keyCopy := make([]byte, len(key)) + copy(keyCopy, key) + valueCopy := make([]byte, len(value)) + copy(valueCopy, value) + + r.ops = append(r.ops, StorageOp{ + IsDelete: false, + Key: keyCopy, + Value: valueCopy, + }) + r.inner.Set(key, value) +} + +// Delete records the operation and delegates to the inner store +func (r *RecordingKVStore) Delete(key []byte) { + // Copy key to avoid issues with reused buffers + keyCopy := make([]byte, len(key)) + copy(keyCopy, key) + + r.ops = append(r.ops, StorageOp{ + IsDelete: true, + Key: keyCopy, + Value: nil, + }) + r.inner.Delete(key) +} + +// Iterator delegates to the inner store +func (r *RecordingKVStore) Iterator(start, end []byte) dbm.Iterator { + return r.inner.Iterator(start, end) +} + +// ReverseIterator delegates to the inner store +func (r *RecordingKVStore) ReverseIterator(start, end []byte) dbm.Iterator { + return r.inner.ReverseIterator(start, end) +} + +// GetOps returns all recorded operations +func (r *RecordingKVStore) GetOps() []StorageOp { + return r.ops +} + +// ClearOps clears recorded operations +func (r *RecordingKVStore) ClearOps() { + r.ops = nil +} + +// ReplayingKVStore applies recorded operations to a store without calling the enclave +type ReplayingKVStore struct { + inner KVStore +} + +// NewReplayingKVStore creates a store that can replay operations +func NewReplayingKVStore(inner KVStore) *ReplayingKVStore { + return &ReplayingKVStore{inner: inner} +} + +// ApplyOps applies a list of storage operations to the store +func (r *ReplayingKVStore) ApplyOps(ops []StorageOp) { + for _, op := range ops { + if op.IsDelete { + r.inner.Delete(op.Key) + } else { + r.inner.Set(op.Key, op.Value) + } + } +} + +// Get delegates to the inner store +func (r *ReplayingKVStore) Get(key []byte) []byte { + return r.inner.Get(key) +} + +// Set delegates to the inner store +func (r *ReplayingKVStore) Set(key, value []byte) { + r.inner.Set(key, value) +} + +// Delete delegates to the inner store +func (r *ReplayingKVStore) Delete(key []byte) { + r.inner.Delete(key) +} + +// Iterator delegates to the inner store +func (r *ReplayingKVStore) Iterator(start, end []byte) dbm.Iterator { + return r.inner.Iterator(start, end) +} + +// ReverseIterator delegates to the inner store +func (r *ReplayingKVStore) ReverseIterator(start, end []byte) dbm.Iterator { + return r.inner.ReverseIterator(start, end) +} diff --git a/go-cosmwasm/api/recording_store_stub.go b/go-cosmwasm/api/recording_store_stub.go new file mode 100644 index 0000000000..a41925944f --- /dev/null +++ b/go-cosmwasm/api/recording_store_stub.go @@ -0,0 +1,28 @@ +//go:build secretcli +// +build secretcli + +package api + +// Stub implementations for secretcli builds (no SGX support) + +// RecordingKVStore stub for secretcli +type RecordingKVStore struct{} + +// NewRecordingKVStore stub +func NewRecordingKVStore(inner interface{}) *RecordingKVStore { + return nil +} + +func (r *RecordingKVStore) GetOps() []StorageOp { + return nil +} + +// ReplayingKVStore stub for secretcli +type ReplayingKVStore struct{} + +// NewReplayingKVStore stub +func NewReplayingKVStore(inner interface{}) *ReplayingKVStore { + return nil +} + +func (r *ReplayingKVStore) ApplyOps(ops []StorageOp) {} diff --git a/go-cosmwasm/api/replay.go b/go-cosmwasm/api/replay.go new file mode 100644 index 0000000000..df23f54d25 --- /dev/null +++ b/go-cosmwasm/api/replay.go @@ -0,0 +1,104 @@ +//go:build !secretcli + +package api + +import ( + "fmt" + "time" + + "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types" +) + +// replayExecution handles replay of a recorded execution trace. +// We trust the SGX node's trace data completely. +// +// Gas is consumed in two steps to exactly match the SGX node: +// 1. callbackGas: charged on the original SDK meter directly (callbackGas/1000 SDK gas) +// This matches the SGX node where DB callbacks charge gas on ctx.GasMeter() during C.handle. +// 2. gasUsed (compute gas): returned to the caller so the keeper's consumeGas handles it, +// adding (gasUsed/1000 + 1) SDK gas — same as on the SGX node. +// +// These must be separate divisions to avoid integer rounding differences. +func replayExecution(store KVStore, gasMeter *GasMeter, execIndex int64) ([]byte, uint64, error, bool) { + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + + trace, found := recorder.GetTraceFromMemory(execIndex) + if !found { + logDebug("replayExecution", "TRACE NOT FOUND in memory: height=%d index=%d, waiting for SGX node", height, execIndex) + + client := GetEcallClient() + retryDelay := 2 * time.Second + attempt := 0 + + for { + allTraces, err := client.FetchBlockTraces(height) + if err == nil { + recorder.SetBlockTraces(allTraces) + trace, found = recorder.GetTraceFromMemory(execIndex) + if found { + logInfo("replayExecution", "Fetched trace: height=%d index=%d (attempt %d)", height, execIndex, attempt+1) + break + } + } + + attempt++ + if attempt%15 == 1 { // Log every ~30 seconds (15 * 2s) + logWarn("replayExecution", "Waiting for SGX node trace: height=%d index=%d attempt=%d err=%v", height, execIndex, attempt, err) + } + time.Sleep(retryDelay) + } + + if !found { + logWarn("replayExecution", "TRACE NOT FOUND after retries: height=%d index=%d", height, execIndex) + return nil, 0, nil, false + } + } + + logDebug("replayExecution", "Found trace: height=%d index=%d ops=%d resultLen=%d gasUsed=%d callbackGas=%d hasError=%v", + height, execIndex, len(trace.Ops), len(trace.Result), trace.GasUsed, trace.CallbackGas, trace.HasError) + + // Apply recorded storage ops (trusted data from SGX node). + // The store uses an InfiniteGasMeter (set by keeper), so these + // ops do NOT charge the real gas meter. + replayer := NewReplayingKVStore(store) + replayer.ApplyOps(trace.Ops) + + // Stash cross-module ops for the keeper to apply on the real ctx.MultiStore(). + // These are mutations that query handlers made to other modules' stores + // (e.g., distribution rewards withdrawal during a staking query). + if len(trace.CrossOps) > 0 { + logDebug("replayExecution", "Stashing %d cross-module ops for keeper", len(trace.CrossOps)) + recorder.SetPendingCrossModuleOps(trace.CrossOps) + } + + // Consume exactly the CallbackGas recorded by the SGX node. + // Since the store is gas-free, we don't need to reconcile with opsGas. + // This makes the replay node's gas meter match the SGX node exactly. + // + if gasMeter != nil && trace.CallbackGas > 0 { + logDebug("replayExecution", "Consuming exact CallbackGas=%d on real gas meter", trace.CallbackGas) + func() { + defer func() { + if r := recover(); r != nil { + logDebug("replayExecution", + "Caught out-of-gas panic during CallbackGas consumption (expected for failed traces)") + } + }() + (*gasMeter).ConsumeGas(trace.CallbackGas, "replay callback gas (matching SGX trace)") + }() + } + + // Return only compute gasUsed — the keeper's consumeGas will add (gasUsed/1000)+1, + // exactly matching the SGX node's second gas consumption step. + if trace.HasError { + if trace.IsOutOfGas { + logDebug("replayExecution", "Returning OutOfGasError (gasUsed=%d)", trace.GasUsed) + return nil, trace.GasUsed, types.OutOfGasError{}, true + } + logDebug("replayExecution", "Returning error (gasUsed=%d): %s", trace.GasUsed, trace.ErrorMsg) + return nil, trace.GasUsed, fmt.Errorf("%s", trace.ErrorMsg), true + } + + return trace.Result, trace.GasUsed, nil, true +} diff --git a/go-cosmwasm/lib.go b/go-cosmwasm/lib.go index d73c50eb24..cb369ef6e7 100644 --- a/go-cosmwasm/lib.go +++ b/go-cosmwasm/lib.go @@ -45,7 +45,11 @@ func NewWasmer(dataDir string, supportedFeatures string, cacheSize uint64, modul if err != nil { return nil, err } - if initEnclave { + + // Skip enclave runtime initialization in replay mode + // Cache is still needed for storing WASM code + recorder := api.GetRecorder() + if initEnclave && !recorder.IsReplayMode() { err = api.InitEnclaveRuntime(moduleCacheSize) if err != nil { return nil, err diff --git a/go.mod b/go.mod index d6bcd5df95..f8655a898e 100644 --- a/go.mod +++ b/go.mod @@ -8,8 +8,8 @@ replace ( cosmossdk.io/api => github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 cosmossdk.io/store => github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 cosmossdk.io/x/tx => github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 - github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.19-secret.11 - github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.10 + github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.19-secret.11-non-sgx + github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.4-legacy-non-sgx github.com/cosmos/iavl => github.com/scrtlabs/iavl v1.2.2-secret.0 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 @@ -62,7 +62,6 @@ require ( require ( cosmossdk.io/api v0.7.6 - cosmossdk.io/client/v2 v2.0.0-beta.3 cosmossdk.io/collections v0.4.0 cosmossdk.io/math v1.4.0 cosmossdk.io/tools/confix v0.1.2 @@ -76,7 +75,6 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golang/mock v1.6.0 github.com/hashicorp/go-metrics v0.5.3 - github.com/scrtlabs/tm-secret-enclave v1.13.1 golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 gopkg.in/yaml.v2 v2.4.0 ) @@ -202,6 +200,7 @@ require ( github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.5 // indirect + github.com/scrtlabs/tm-secret-enclave v1.13.1 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect diff --git a/go.sum b/go.sum index d9fa04dabe..b9568c0074 100644 --- a/go.sum +++ b/go.sum @@ -1609,8 +1609,8 @@ github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWR github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.10 h1:MJgXkosWs87TCy76l0cbxDUL4/7xlO1fKdFYPGKUkYM= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.10/go.mod h1:czzdPa3SiwDgWM0QqTZLKgwaF9k5w3rMS1kJzHIoGbQ= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.4-legacy-non-sgx h1:8w0Lvd4yjtvNAxLsxYJk5yqouzeyC+4mgcV6jFMXKGo= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.4-legacy-non-sgx/go.mod h1:fKGE9tKmIZlnEVNntZc4kn+KKXScO9Uq4Lcsm4G8fpg= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 h1:9IGLySVhC2qSrxT3fZvvqwjKsnXWSSKnywQDzT8y1Gs= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 h1:TELtwBkSg0xBrs2ObFE0pVVWF6E31fPCDX2tk8OiJPo= @@ -1619,8 +1619,8 @@ github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 h1:i3k5706sDHKhaCvzokB+n33/ github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= github.com/scrtlabs/iavl v1.2.2-secret.0 h1:P96PL1Lf8OBSW9pMrlaRxhceZ4z9Hc7jk12g9ShWeHw= github.com/scrtlabs/iavl v1.2.2-secret.0/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/scrtlabs/tendermint v0.38.19-secret.11 h1:WeIDyA3Svm3fYdp2cRr2U2IE9Q9TYNODTS4Nzifp+xY= -github.com/scrtlabs/tendermint v0.38.19-secret.11/go.mod h1:I8kyAQPjMco6jjCshUSMYFoY6TybsbADGBmGcjWrgKM= +github.com/scrtlabs/tendermint v0.38.19-secret.11-non-sgx h1:FuTQ+cuMxb6YD+0RDfWEJ89pATv7gvn9YqTu5sguz9s= +github.com/scrtlabs/tendermint v0.38.19-secret.11-non-sgx/go.mod h1:I8kyAQPjMco6jjCshUSMYFoY6TybsbADGBmGcjWrgKM= github.com/scrtlabs/tm-secret-enclave v1.13.1 h1:0mXcBdoWyqEGhQEdbXMjSuTi9LKKMld2BqEj0eNpoxU= github.com/scrtlabs/tm-secret-enclave v1.13.1/go.mod h1:nxZQtzzAqBNBLOEXSv4cKlUnVA4vRmHOn6ujr3kxVME= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= diff --git a/proto/secret/compute/v1beta1/query.proto b/proto/secret/compute/v1beta1/query.proto index 8a26e5c39a..8223b9c9a4 100644 --- a/proto/secret/compute/v1beta1/query.proto +++ b/proto/secret/compute/v1beta1/query.proto @@ -78,6 +78,42 @@ service Query { rpc AuthorizedAdminUpdate(QueryAuthorizedAdminUpdateRequest) returns (QueryAuthorizedAdminUpdateResponse) { option (google.api.http).get = "/compute/v1beta1/authorized_admin_update/{contract_address}"; } + + // Query ecall record for a specific block height (for non-SGX node sync) + rpc EcallRecord(QueryEcallRecordRequest) returns (QueryEcallRecordResponse) { + option (google.api.http).get = "/compute/v1beta1/ecall/{height}"; + } + + // Query ecall records for a range of block heights (batch sync) + rpc EcallRecords(QueryEcallRecordsRequest) returns (QueryEcallRecordsResponse) { + option (google.api.http).get = "/compute/v1beta1/ecalls"; + } + + // Query encrypted seed by certificate hash (for non-SGX node sync) + rpc EncryptedSeed(QueryEncryptedSeedRequest) returns (QueryEncryptedSeedResponse) { + option (google.api.http).get = "/compute/v1beta1/encrypted_seed/{cert_hash}"; + } + + // Query all execution traces for a block (batch fetch for non-SGX node sync) + rpc BlockTraces(QueryBlockTracesRequest) returns (QueryBlockTracesResponse) { + option (google.api.http).get = "/compute/v1beta1/block_traces/{height}"; + } + + // Query machine ID proof for a specific block height and machine ID (for non-SGX node sync) + rpc MachineIDProof(QueryMachineIDProofRequest) returns (QueryMachineIDProofResponse) { + option (google.api.http).get = "/compute/v1beta1/machine_id_proof/{height}/{machine_id}"; + } + + // Analyze code to determine IBC entry points and required features + rpc AnalyzeCode(QueryAnalyzeCodeRequest) returns (QueryAnalyzeCodeResponse) { + option (google.api.http).get = "/compute/v1beta1/analyze_code"; + } + + // Query all Create (MsgStoreCode) results for a block (for non-SGX node sync) + rpc BlockCreateResults(QueryBlockCreateResultsRequest) returns (QueryBlockCreateResultsResponse) { + option (google.api.http).get = "/compute/v1beta1/block_create_results/{height}"; + } + } // ParamsRequest is the request type for the Query/Params RPC method. @@ -205,6 +241,7 @@ message QueryAuthorizedMigrationResponse { uint64 new_code_id = 1 [ (gogoproto.customname) = "NewCodeID" ]; } + message QueryAuthorizedAdminUpdateRequest { // Contract address to query string contract_address = 1; @@ -213,4 +250,155 @@ message QueryAuthorizedAdminUpdateRequest { message QueryAuthorizedAdminUpdateResponse { // Authorized new admin address (empty string if removing admin, or if no authorization) string new_admin = 1; +} + +// QueryEcallRecordRequest is the request type for the Query/EcallRecord RPC method +message QueryEcallRecordRequest { + // Block height to query ecall record for + int64 height = 1; +} + +// QueryEcallRecordResponse is the response type for the Query/EcallRecord RPC method +message QueryEcallRecordResponse { + // Block height + int64 height = 1; + // Random seed from SubmitBlockSignatures (32 bytes) + bytes random_seed = 2; + // Validator set evidence from SubmitBlockSignatures (32 bytes) + bytes validator_set_evidence = 3; +} + +// QueryEcallRecordsRequest is the request type for the Query/EcallRecords RPC method +message QueryEcallRecordsRequest { + // Start block height (inclusive) + int64 start_height = 1; + // End block height (inclusive) + int64 end_height = 2; +} + +// QueryEcallRecordsResponse is the response type for the Query/EcallRecords RPC method +message QueryEcallRecordsResponse { + // List of ecall records + repeated QueryEcallRecordResponse records = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryEncryptedSeedRequest is the request type for the Query/EncryptedSeed RPC method +message QueryEncryptedSeedRequest { + // Certificate hash (hex encoded sha256 of certificate) + string cert_hash = 1; + // Block height at which the seed was recorded (required for per-height keying) + int64 height = 2; +} + +// QueryEncryptedSeedResponse is the response type for the Query/EncryptedSeed RPC method +message QueryEncryptedSeedResponse { + // Encrypted seed data + bytes encrypted_seed = 1; +} + +// StorageOp represents a single storage operation (Set or Delete) +message StorageOp { + // True if this is a delete operation, false for set + bool is_delete = 1; + // Storage key + bytes key = 2; + // Storage value (empty for delete operations) + bytes value = 3; +} + +// CrossModuleOp represents a storage operation on a different module's store +message CrossModuleOp { + // The store key identifying the module (e.g., "bank", "staking") + string store_key = 1; + // Storage key within the module's store + bytes key = 2; + // Storage value (empty for delete operations) + bytes value = 3; + // True if this is a delete operation, false for set + bool is_delete = 4; +} + +// ExecutionTraceData is a single execution trace with its index +message ExecutionTraceData { + // Execution index within the block + int64 index = 1; + // List of storage operations performed during execution + repeated StorageOp ops = 2 [ (gogoproto.nullable) = false ]; + // Return value from the contract execution + bytes result = 3; + // Gas used during execution (compute gas from WASM) + uint64 gas_used = 4; + // Gas consumed by callbacks (store operations) during execution + uint64 callback_gas = 7; + // Whether the execution resulted in an error + bool has_error = 5; + // Error message (if has_error is true) + string error_msg = 6; + // List of cross-module storage operations (e.g., bank balance changes) + repeated CrossModuleOp cross_ops = 8 [ (gogoproto.nullable) = false ]; +} + +// QueryBlockTracesRequest is the request type for the Query/BlockTraces RPC method +message QueryBlockTracesRequest { + // Block height to query traces for + int64 height = 1; +} + +// QueryBlockTracesResponse is the response type for the Query/BlockTraces RPC method +message QueryBlockTracesResponse { + // All execution traces for the block + repeated ExecutionTraceData traces = 1 [ (gogoproto.nullable) = false ]; +} + +// QueryMachineIDProofRequest is the request type for the Query/MachineIDProof RPC method +message QueryMachineIDProofRequest { + // Block height where the machine ID was approved + int64 height = 1; + // Machine ID (hex encoded) + string machine_id = 2; +} + +// QueryMachineIDProofResponse is the response type for the Query/MachineIDProof RPC method +message QueryMachineIDProofResponse { + // Proof bytes (32 bytes) + bytes proof = 1; +} + +// QueryAnalyzeCodeRequest is the request type for the Query/AnalyzeCode RPC method +message QueryAnalyzeCodeRequest { + // Code hash (raw bytes, typically 32 bytes SHA256) + bytes code_hash = 1; +} + +// QueryAnalyzeCodeResponse is the response type for the Query/AnalyzeCode RPC method +message QueryAnalyzeCodeResponse { + // Whether the code has IBC entry points (ibc_channel_open, ibc_channel_connect, etc.) + bool has_ibc_entry_points = 1; + // Comma-separated list of required features (e.g., "staking", "stargate") + string required_features = 2; +} + +// CreateResultData stores the outcome of a single MsgStoreCode execution +message CreateResultData { + // SHA256 of the original WASM bytecode + bytes wasm_hash = 1; + // Code hash computed by the enclave (empty on error) + bytes code_hash = 2; + // Whether the enclave rejected the code + bool has_error = 3; + // Error message (if has_error is true) + string error_msg = 4; +} + +// QueryBlockCreateResultsRequest is the request type for the Query/BlockCreateResults RPC method +message QueryBlockCreateResultsRequest { + // Block height to query Create results for + int64 height = 1; +} + +// QueryBlockCreateResultsResponse is the response type for the Query/BlockCreateResults RPC method +message QueryBlockCreateResultsResponse { + // All Create results for the block + repeated CreateResultData results = 1 [ (gogoproto.nullable) = false ]; + } \ No newline at end of file diff --git a/x/compute/internal/keeper/keeper.go b/x/compute/internal/keeper/keeper.go index c755d5aeec..0abb6dbd43 100644 --- a/x/compute/internal/keeper/keeper.go +++ b/x/compute/internal/keeper/keeper.go @@ -98,6 +98,16 @@ type Keeper struct { // paramSpace subspace.Subspace LastMsgManager *baseapp.LastMsgMarkerContainer authority string + // storeKeys maps store key names to the app's registered StoreKey + // instances so ApplyCrossModuleOps resolves correct pointers. + storeKeys map[string]storetypes.StoreKey +} + +// SetStoreKeys provides the keeper with the app's registered store key +// instances so ApplyCrossModuleOps can resolve string names to the exact +// pointers that CacheMultiStore expects. +func (k *Keeper) SetStoreKeys(keys map[string]storetypes.StoreKey) { + k.storeKeys = keys } func moduleLogger(ctx sdk.Context) log.Logger { @@ -707,16 +717,40 @@ func (k Keeper) Instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.A // create prefixed data store // 0x03 | contractAddress (sdk.AccAddress) prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) - prefixStore := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), prefixStoreKey) + recorder := api.GetRecorder() + var storeForExecution prefix.Store + if recorder.IsReplayMode() { + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas. The real gas meter is charged exactly with + // trace.CallbackGas by replayExecution instead. + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + storeForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + storeForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), prefixStoreKey) + } // prepare querier + querierCtx := ctx + if recorder.IsSGXMode() { + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, Caller: contractAddress, } - response, ogContractKey, adminProof, gasUsed, initError := k.wasmer.Instantiate(codeInfo.CodeHash, env, initMsg, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gasForContract(ctx), sigInfo, admin) + response, ogContractKey, adminProof, gasUsed, initError := k.wasmer.Instantiate(codeInfo.CodeHash, env, initMsg, storeForExecution, cosmwasmAPI, querier, ctx.GasMeter(), gasForContract(ctx), sigInfo, admin) + + // In replay mode, apply any cross-module ops stashed by replayExecution. + if recorder.IsReplayMode() { + crossOps := recorder.GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } + consumeGas(ctx, gasUsed) if initError != nil { @@ -887,13 +921,45 @@ func (k Keeper) Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller env := types.NewEnv(ctx, caller, coins, contractAddress, contractKey, random) // prepare querier + recorder := api.GetRecorder() + querierCtx := ctx + if recorder.IsSGXMode() { + // In SGX (recording) mode, wrap the querier's ctx with RecordingMultiStore + // so that cross-module writes during queries (e.g., distribution reward + // withdrawals) are captured and included in the execution trace. + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, Caller: contractAddress, } - response, gasUsed, execErr := k.wasmer.Execute(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, handleType) + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas on the real gas meter. replayExecution will charge + // exactly trace.CallbackGas instead. + var storeForExecution prefix.Store + if recorder.IsReplayMode() { + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) + storeForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + storeForExecution = prefixStore + } + + response, gasUsed, execErr := k.wasmer.Execute(codeInfo.CodeHash, env, msg, storeForExecution, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, handleType) + + // In replay mode, apply any cross-module ops that were stashed by replayExecution. + // These are writes to other modules' stores (e.g., distribution, staking) that + // happened during query callbacks on the SGX node. + if recorder.IsReplayMode() { + crossOps := recorder.GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } + consumeGas(ctx, gasUsed) if execErr != nil { @@ -1446,6 +1512,9 @@ func (k *Keeper) handleContractResponse( // This is used mainly in replies in order to decrypt their data. ogSigInfo wasmTypes.SigInfo, ) ([]byte, error) { + ctx.Logger().Info(fmt.Sprintf("[handleContractResponse] height=%d contract=%s numSubMsgs=%d numLogs=%d numEvents=%d dataLen=%d gasConsumed=%d", + ctx.BlockHeight(), contractAddr.String(), len(msgs), len(logs), len(evts), len(data), ctx.GasMeter().GasConsumed())) + events := types.ContractLogsToSdkEvents(logs, contractAddr) ctx.EventManager().EmitEvents(events) @@ -1480,6 +1549,7 @@ func gasForContract(ctx sdk.Context) uint64 { func consumeGas(ctx sdk.Context, gas uint64) { consumed := (gas / types.GasMultiplier) + 1 + ctx.Logger().Debug("Consuming compute gas", "wasmGas", gas, "sdkGas", consumed, "multiplier", types.GasMultiplier) ctx.GasMeter().ConsumeGas(consumed, "wasm contract") // throw OutOfGas error if we ran out (got exactly to zero due to better limit enforcing) if ctx.GasMeter().IsOutOfGas() { @@ -1598,6 +1668,16 @@ func (m MultipiedGasMeter) GasConsumed() storetypes.Gas { return m.originalMeter.GasConsumed() * types.GasMultiplier } +func (m MultipiedGasMeter) ConsumeGas(amount storetypes.Gas, descriptor string) { + // Divide by GasMultiplier since GasConsumed() multiplies by it + m.originalMeter.ConsumeGas(amount/types.GasMultiplier, descriptor) +} + +// OriginalMeter returns the underlying gas meter (for measuring callback gas) +func (m MultipiedGasMeter) OriginalMeter() storetypes.GasMeter { + return m.originalMeter +} + func gasMeter(ctx sdk.Context) MultipiedGasMeter { return MultipiedGasMeter{ originalMeter: ctx.GasMeter(), @@ -1651,8 +1731,14 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply v1w env := types.NewEnv(ctx, contractAddress, sdk.Coins{}, contractAddress, contractKey, random) // prepare querier + recorder := api.GetRecorder() + querierCtx := ctx + if recorder.IsSGXMode() { + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, Caller: contractAddress, } @@ -1664,7 +1750,27 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply v1w return nil, err } - response, gasUsed, execErr := k.wasmer.Execute(codeInfo.CodeHash, env, marshaledReply, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gasForContract(ctx), ogSigInfo, wasmTypes.HandleTypeReply) + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas on the real gas meter. + var replyStoreForExecution prefix.Store + if recorder.IsReplayMode() { + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) + replyStoreForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + replyStoreForExecution = prefixStore + } + + response, gasUsed, execErr := k.wasmer.Execute(codeInfo.CodeHash, env, marshaledReply, replyStoreForExecution, cosmwasmAPI, querier, ctx.GasMeter(), gasForContract(ctx), ogSigInfo, wasmTypes.HandleTypeReply) + + // In replay mode, apply any cross-module ops stashed by replayExecution. + if recorder.IsReplayMode() { + crossOps := recorder.GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } + consumeGas(ctx, gasUsed) if execErr != nil { @@ -1751,14 +1857,38 @@ func (k Keeper) UpdateContractAdmin(ctx sdk.Context, contractAddress, caller, ne } // prepare querier - // TODO: this is unnecessary, get rid of this + recorder := api.GetRecorder() + querierCtx := ctx + if recorder.IsSGXMode() { + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, Caller: contractAddress, } - newAdminProof, updateAdminErr := k.wasmer.UpdateAdmin(codeInfo.CodeHash, env, prefixStore, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, currentAdminAddress, contractInfo.AdminProof, newAdmin) + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas on the real gas meter. + var adminStoreForExecution prefix.Store + if recorder.IsReplayMode() { + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) + adminStoreForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + adminStoreForExecution = prefixStore + } + + newAdminProof, updateAdminErr := k.wasmer.UpdateAdmin(codeInfo.CodeHash, env, adminStoreForExecution, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, currentAdminAddress, contractInfo.AdminProof, newAdmin) + + // In replay mode, apply any cross-module ops stashed by replayExecution. + if recorder.IsReplayMode() { + crossOps := recorder.GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } if updateAdminErr != nil { return updateAdminErr @@ -1869,13 +1999,39 @@ func (k Keeper) Migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller } // prepare querier + recorder := api.GetRecorder() + querierCtx := ctx + if recorder.IsSGXMode() { + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, Caller: contractAddress, } - response, newContractKey, newContractKeyProof, gasUsed, migrateErr := k.wasmer.Migrate(newCodeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, adminAddr, adminProof) + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas on the real gas meter. + var storeForExecution prefix.Store + if recorder.IsReplayMode() { + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) + storeForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + storeForExecution = prefixStore + } + + response, newContractKey, newContractKeyProof, gasUsed, migrateErr := k.wasmer.Migrate(newCodeInfo.CodeHash, env, msg, storeForExecution, cosmwasmAPI, querier, gasMeter(ctx), gasForContract(ctx), sigInfo, adminAddr, adminProof) + + // In replay mode, apply any cross-module ops stashed by replayExecution. + if recorder.IsReplayMode() { + crossOps := recorder.GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } + consumeGas(ctx, gasUsed) if migrateErr != nil { diff --git a/x/compute/internal/keeper/msg_dispatcher.go b/x/compute/internal/keeper/msg_dispatcher.go index 35fd2bd4ed..22c2e2b13e 100644 --- a/x/compute/internal/keeper/msg_dispatcher.go +++ b/x/compute/internal/keeper/msg_dispatcher.go @@ -195,7 +195,59 @@ func redactError(err error) (bool, error) { // that dispatched them, both on success as well as failure func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, msgs []v1wasmTypes.SubMsg, ogTx []byte, ogSigInfo wasmTypes.SigInfo) ([]byte, error) { var rsp []byte - for _, msg := range msgs { + + ctx.Logger().Info(fmt.Sprintf("[DispatchSubmessages] height=%d contract=%s numMsgs=%d gasConsumed=%d", + ctx.BlockHeight(), contractAddr.String(), len(msgs), ctx.GasMeter().GasConsumed())) + + for i, msg := range msgs { + + // Log submessage details + msgType := "unknown" + msgDetail := "" + if msg.Msg.Bank != nil { + if msg.Msg.Bank.Send != nil { + msgType = "bank/send" + msgDetail = fmt.Sprintf("to=%s coins=%v", msg.Msg.Bank.Send.ToAddress, msg.Msg.Bank.Send.Amount) + } else if msg.Msg.Bank.Burn != nil { + msgType = "bank/burn" + msgDetail = fmt.Sprintf("coins=%v", msg.Msg.Bank.Burn.Amount) + } + } else if msg.Msg.Staking != nil { + if msg.Msg.Staking.Delegate != nil { + msgType = "staking/delegate" + msgDetail = fmt.Sprintf("validator=%s amount=%v", msg.Msg.Staking.Delegate.Validator, msg.Msg.Staking.Delegate.Amount) + } else if msg.Msg.Staking.Undelegate != nil { + msgType = "staking/undelegate" + msgDetail = fmt.Sprintf("validator=%s amount=%v", msg.Msg.Staking.Undelegate.Validator, msg.Msg.Staking.Undelegate.Amount) + } else if msg.Msg.Staking.Redelegate != nil { + msgType = "staking/redelegate" + msgDetail = fmt.Sprintf("src=%s dst=%s amount=%v", msg.Msg.Staking.Redelegate.SrcValidator, msg.Msg.Staking.Redelegate.DstValidator, msg.Msg.Staking.Redelegate.Amount) + } else if msg.Msg.Staking.Withdraw != nil { + msgType = "staking/withdraw" + msgDetail = fmt.Sprintf("validator=%s recipient=%s", msg.Msg.Staking.Withdraw.Validator, msg.Msg.Staking.Withdraw.Recipient) + } + } else if msg.Msg.Wasm != nil { + if msg.Msg.Wasm.Execute != nil { + msgType = "wasm/execute" + msgDetail = fmt.Sprintf("contract=%s msgLen=%d", msg.Msg.Wasm.Execute.ContractAddr, len(msg.Msg.Wasm.Execute.Msg)) + } else if msg.Msg.Wasm.Instantiate != nil { + msgType = "wasm/instantiate" + msgDetail = fmt.Sprintf("codeID=%d label=%s", msg.Msg.Wasm.Instantiate.CodeID, msg.Msg.Wasm.Instantiate.Label) + } + } else if msg.Msg.Custom != nil { + msgType = "custom" + msgDetail = fmt.Sprintf("dataLen=%d", len(msg.Msg.Custom)) + } else if msg.Msg.Gov != nil { + msgType = "gov" + } else if msg.Msg.IBC != nil { + msgType = "ibc" + } else if msg.Msg.Distribution != nil { + msgType = "distribution" + } else if msg.Msg.Stargate != nil { + msgType = "stargate" + } + ctx.Logger().Info(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] id=%s type=%s replyOn=%s gasLimit=%v detail=%s gasBefore=%d", + ctx.BlockHeight(), i, string(msg.ID), msgType, msg.ReplyOn, msg.GasLimit, msgDetail, ctx.GasMeter().GasConsumed())) if d.keeper.GetLastMsgMarkerContainer().GetMarker() { return nil, sdkerrors.ErrLastTx.Wrap("Cannot send messages or submessages after last tx marker was set") @@ -233,6 +285,19 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk events, data, err = d.messenger.DispatchMsg(subCtx, contractAddr, ibcPort, msg.Msg) } + // Log dispatch result + totalDataLen := 0 + for _, d := range data { + totalDataLen += len(d) + } + if err != nil { + ctx.Logger().Info(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] FAILED: %v gasAfter=%d", + ctx.BlockHeight(), i, err, ctx.GasMeter().GasConsumed())) + } else { + ctx.Logger().Info(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] SUCCESS: events=%d dataChunks=%d totalDataLen=%d gasAfter=%d", + ctx.BlockHeight(), i, len(events), len(data), totalDataLen, ctx.GasMeter().GasConsumed())) + } + // if it succeeds, commit state changes from submessage, and pass on events to Event Manager var filteredEvents []sdk.Event if err == nil { diff --git a/x/compute/internal/keeper/msg_server.go b/x/compute/internal/keeper/msg_server.go index 9a62c9f2c5..4fbc293586 100644 --- a/x/compute/internal/keeper/msg_server.go +++ b/x/compute/internal/keeper/msg_server.go @@ -81,7 +81,7 @@ func (m msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInst }, err } -func (m msgServer) ExecuteContract(goCtx context.Context, msg *types.MsgExecuteContract) (*types.MsgExecuteContractResponse, error) { +func (m msgServer) ExecuteContract(goCtx context.Context, msg *types.MsgExecuteContract) (res *types.MsgExecuteContractResponse, err error) { ctx := sdk.UnwrapSDKContext(goCtx) ctx.EventManager().EmitEvent(sdk.NewEvent( diff --git a/x/compute/internal/keeper/querier.go b/x/compute/internal/keeper/querier.go index e3b043cac4..a7073c5ca8 100644 --- a/x/compute/internal/keeper/querier.go +++ b/x/compute/internal/keeper/querier.go @@ -3,6 +3,7 @@ package keeper import ( "context" "encoding/hex" + "fmt" "sort" "github.com/golang/protobuf/ptypes/empty" @@ -13,6 +14,7 @@ import ( storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/scrtlabs/SecretNetwork/go-cosmwasm/api" "github.com/scrtlabs/SecretNetwork/x/compute/internal/types" ) @@ -278,6 +280,297 @@ func (q GrpcQuerier) AuthorizedAdminUpdate(c context.Context, req *types.QueryAu return response, nil } +// EcallRecord returns the ecall record for a specific block height +// This is used by non-SGX nodes to sync with the network +// SECURITY: Only returns data for heights < current height (prevents non-SGX nodes from participating in consensus) +func (q GrpcQuerier) EcallRecord(c context.Context, req *types.QueryEcallRecordRequest) (*types.QueryEcallRecordResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.Height <= 0 { + return nil, status.Error(codes.InvalidArgument, "height must be positive") + } + + // SECURITY: Enforce height restriction - only allow querying heights < current height + // This prevents non-SGX nodes from getting data for the current block and participating in consensus + ctx := sdk.UnwrapSDKContext(c) + currentHeight := ctx.BlockHeight() + if req.Height >= currentHeight { + return nil, status.Errorf(codes.FailedPrecondition, "cannot query ecall record for height %d: must be less than current height %d", req.Height, currentHeight) + } + + recorder := api.GetRecorder() + random, evidence, found := recorder.ReplaySubmitBlockSignatures(req.Height) + if !found { + return nil, status.Error(codes.NotFound, "no ecall record found for the given height") + } + + return &types.QueryEcallRecordResponse{ + Height: req.Height, + RandomSeed: random, + ValidatorSetEvidence: evidence, + }, nil +} + +// EcallRecords returns ecall records for a range of block heights +// This is used by non-SGX nodes to batch sync with the network +// SECURITY: Only returns data for heights < current height (prevents non-SGX nodes from participating in consensus) +func (q GrpcQuerier) EcallRecords(c context.Context, req *types.QueryEcallRecordsRequest) (*types.QueryEcallRecordsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.StartHeight <= 0 { + return nil, status.Error(codes.InvalidArgument, "start_height must be positive") + } + + if req.EndHeight < req.StartHeight { + return nil, status.Error(codes.InvalidArgument, "end_height must be >= start_height") + } + + // Limit the range to prevent abuse (max 1000 blocks per request) + maxRange := int64(1000) + if req.EndHeight-req.StartHeight > maxRange { + return nil, status.Errorf(codes.InvalidArgument, "range too large, max %d blocks per request", maxRange) + } + + // SECURITY: Enforce height restriction - only allow querying heights < current height + // This prevents non-SGX nodes from getting data for the current block and participating in consensus + ctx := sdk.UnwrapSDKContext(c) + currentHeight := ctx.BlockHeight() + if req.EndHeight >= currentHeight { + // Clamp end height to currentHeight - 1 + req.EndHeight = currentHeight - 1 + } + if req.StartHeight >= currentHeight { + return nil, status.Errorf(codes.FailedPrecondition, "cannot query ecall records for height %d: must be less than current height %d", req.StartHeight, currentHeight) + } + + recorder := api.GetRecorder() + var records []types.QueryEcallRecordResponse + + for height := req.StartHeight; height <= req.EndHeight; height++ { + random, evidence, found := recorder.ReplaySubmitBlockSignatures(height) + if found { + records = append(records, types.QueryEcallRecordResponse{ + Height: height, + RandomSeed: random, + ValidatorSetEvidence: evidence, + }) + } + } + + return &types.QueryEcallRecordsResponse{ + Records: records, + }, nil +} + +// EncryptedSeed returns the encrypted seed for a specific certificate hash +// This is used by non-SGX nodes to sync with the network +func (q GrpcQuerier) EncryptedSeed(c context.Context, req *types.QueryEncryptedSeedRequest) (*types.QueryEncryptedSeedResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.CertHash == "" { + return nil, status.Error(codes.InvalidArgument, "cert_hash is required") + } + + fmt.Printf("[INFO] gRPC EncryptedSeed query: certHash=%s height=%d\n", req.CertHash, req.Height) + + // Decode hex string to bytes + certHash, err := hex.DecodeString(req.CertHash) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid cert_hash: must be hex encoded") + } + + recorder := api.GetRecorder() + encryptedSeed, errMsg, found := recorder.ReplayGetEncryptedSeed(req.Height, certHash) + if !found { + fmt.Printf("[INFO] gRPC EncryptedSeed: NOT FOUND in DB for certHash=%s height=%d\n", req.CertHash, req.Height) + return nil, status.Error(codes.NotFound, "no encrypted seed found for the given certificate hash") + } + if errMsg != "" { + fmt.Printf("[INFO] gRPC EncryptedSeed: found recorded ERROR for certHash=%s height=%d: %s\n", req.CertHash, req.Height, errMsg) + // Return the recorded error message so non-SGX nodes can replay the exact same error + return nil, status.Error(codes.FailedPrecondition, errMsg) + } + + fmt.Printf("[INFO] gRPC EncryptedSeed: found SUCCESS for certHash=%s height=%d seedLen=%d\n", req.CertHash, req.Height, len(encryptedSeed)) + + return &types.QueryEncryptedSeedResponse{ + EncryptedSeed: encryptedSeed, + }, nil +} + +// MachineIDProof returns the recorded proof bytes for a specific machine ID at a given height +// This is used by non-SGX nodes to replay machine ID approval ecalls +func (q GrpcQuerier) MachineIDProof(c context.Context, req *types.QueryMachineIDProofRequest) (*types.QueryMachineIDProofResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.Height <= 0 { + return nil, status.Error(codes.InvalidArgument, "height must be positive") + } + + if req.MachineId == "" { + return nil, status.Error(codes.InvalidArgument, "machine_id is required") + } + + // Decode hex string to bytes + machineID, err := hex.DecodeString(req.MachineId) + if err != nil { + return nil, status.Error(codes.InvalidArgument, "invalid machine_id: must be hex encoded") + } + + recorder := api.GetRecorder() + proof, found := recorder.ReplayMachineIDProof(req.Height, machineID) + if !found { + return nil, status.Errorf(codes.NotFound, "no machine ID proof found for height %d", req.Height) + } + + return &types.QueryMachineIDProofResponse{ + Proof: proof, + }, nil +} + +// BlockTraces returns all execution traces for a specific block height +// This is used by non-SGX nodes to batch fetch all traces for a block +// SECURITY: Only returns data for heights < current height (prevents non-SGX nodes from participating in consensus) +func (q GrpcQuerier) BlockTraces(c context.Context, req *types.QueryBlockTracesRequest) (*types.QueryBlockTracesResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.Height <= 0 { + return nil, status.Error(codes.InvalidArgument, "height must be positive") + } + + // SECURITY: Enforce height restriction - only allow querying heights < current height + // This prevents non-SGX nodes from getting data for the current block and participating in consensus + ctx := sdk.UnwrapSDKContext(c) + currentHeight := ctx.BlockHeight() + if req.Height >= currentHeight { + return nil, status.Errorf(codes.FailedPrecondition, "cannot query block traces for height %d: must be less than current height %d", req.Height, currentHeight) + } + + ctx.Logger().Debug("BlockTraces query received", "height", req.Height) + recorder := api.GetRecorder() + traces, err := recorder.GetAllTracesForBlock(req.Height) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get traces: %v", err) + } + + ctx.Logger().Debug("Retrieved traces from database", "count", len(traces)) + + // Convert api.ExecutionTrace to types.ExecutionTraceData + protoTraces := make([]types.ExecutionTraceData, len(traces)) + for i, trace := range traces { + ctx.Logger().Debug("Converting trace", "index", trace.Index, "callbackGas", trace.CallbackGas) + ops := make([]types.StorageOp, len(trace.Ops)) + for j, op := range trace.Ops { + ops[j] = types.StorageOp{ + IsDelete: op.IsDelete, + Key: op.Key, + Value: op.Value, + } + } + crossOps := make([]types.CrossModuleOp, len(trace.CrossOps)) + for j, cop := range trace.CrossOps { + crossOps[j] = types.CrossModuleOp{ + StoreKey: cop.StoreKey, + Key: cop.Key, + Value: cop.Value, + IsDelete: cop.IsDelete, + } + } + protoTraces[i] = types.ExecutionTraceData{ + Index: trace.Index, + Ops: ops, + Result: trace.Result, + GasUsed: trace.GasUsed, + CallbackGas: trace.CallbackGas, + HasError: trace.HasError, + ErrorMsg: trace.ErrorMsg, + CrossOps: crossOps, + } + ctx.Logger().Debug("Proto trace converted", "callbackGas", protoTraces[i].CallbackGas) + } + + firstTraceCallbackGas := uint64(0) + if len(protoTraces) > 0 { + firstTraceCallbackGas = protoTraces[0].CallbackGas + } + ctx.Logger().Debug("Returning traces", "count", len(protoTraces), "firstTraceCallbackGas", firstTraceCallbackGas) + + return &types.QueryBlockTracesResponse{ + Traces: protoTraces, + }, nil +} + +// AnalyzeCode returns the static analysis of a contract's code +// This is used by non-SGX nodes to determine IBC entry points and required features +func (q GrpcQuerier) AnalyzeCode(c context.Context, req *types.QueryAnalyzeCodeRequest) (*types.QueryAnalyzeCodeResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if len(req.CodeHash) == 0 { + return nil, status.Error(codes.InvalidArgument, "code hash is required") + } + + report, err := q.keeper.wasmer.AnalyzeCode(req.CodeHash) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to analyze code: %v", err) + } + + return &types.QueryAnalyzeCodeResponse{ + HasIbcEntryPoints: report.HasIBCEntryPoints, + RequiredFeatures: report.RequiredFeatures, + }, nil +} + +// BlockCreateResults returns all Create (MsgStoreCode) results for a block +// This is used by non-SGX nodes to fetch Create outcomes during sync +func (q GrpcQuerier) BlockCreateResults(c context.Context, req *types.QueryBlockCreateResultsRequest) (*types.QueryBlockCreateResultsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if req.Height <= 0 { + return nil, status.Error(codes.InvalidArgument, "height must be positive") + } + + // SECURITY: Enforce height restriction - only allow querying heights < current height + ctx := sdk.UnwrapSDKContext(c) + currentHeight := ctx.BlockHeight() + if req.Height >= currentHeight { + return nil, status.Errorf(codes.FailedPrecondition, "cannot query block create results for height %d: must be less than current height %d", req.Height, currentHeight) + } + + recorder := api.GetRecorder() + results, wasmHashes, err := recorder.GetAllCreateResultsForBlock(req.Height) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get create results: %v", err) + } + + protoResults := make([]types.CreateResultData, len(results)) + for i, r := range results { + protoResults[i] = types.CreateResultData{ + WasmHash: wasmHashes[i], + CodeHash: r.CodeHash, + HasError: r.HasError, + ErrorMsg: r.ErrorMsg, + } + } + + return &types.QueryBlockCreateResultsResponse{ + Results: protoResults, + }, nil +} + func queryContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress, keeper Keeper) (*types.ContractInfoWithAddress, error) { info := keeper.GetContractInfo(ctx, contractAddress) if info == nil { diff --git a/x/compute/internal/keeper/recording_multistore.go b/x/compute/internal/keeper/recording_multistore.go new file mode 100644 index 0000000000..a7f159b1dd --- /dev/null +++ b/x/compute/internal/keeper/recording_multistore.go @@ -0,0 +1,232 @@ +package keeper + +import ( + "fmt" + "io" + + storetypes "cosmossdk.io/store/types" + "github.com/scrtlabs/SecretNetwork/go-cosmwasm/api" +) + +// RecordingMultiStore wraps a MultiStore and intercepts GetKVStore, +// returning RecordingKVStore wrappers that record writes as CrossModuleOps +// on the EcallRecorder. +// +// All stores are recorded EXCEPT those listed in excludedKeys (typically +// the compute module's own store, which is recorded inside the enclave). +type RecordingMultiStore struct { + storetypes.MultiStore + recorder *api.EcallRecorder + excludedKeys map[string]bool // store key names to exclude from recording +} + +// NewRecordingMultiStore creates a recording wrapper around the given MultiStore. +// excludedKeys are store keys whose writes should NOT be recorded (e.g. the compute store). +func NewRecordingMultiStore( + inner storetypes.MultiStore, + recorder *api.EcallRecorder, + excludedKeys []storetypes.StoreKey, +) *RecordingMultiStore { + ek := make(map[string]bool, len(excludedKeys)) + for _, sk := range excludedKeys { + ek[sk.Name()] = true + } + return &RecordingMultiStore{ + MultiStore: inner, + recorder: recorder, + excludedKeys: ek, + } +} + +func (rms *RecordingMultiStore) GetKVStore(key storetypes.StoreKey) storetypes.KVStore { + inner := rms.MultiStore.GetKVStore(key) + if rms.excludedKeys[key.Name()] { + return inner + } + return &RecordingKVStore{ + KVStore: inner, + storeKey: key.Name(), + recorder: rms.recorder, + } +} + +func (rms *RecordingMultiStore) GetStore(key storetypes.StoreKey) storetypes.Store { + return rms.MultiStore.GetStore(key) +} + +func (rms *RecordingMultiStore) CacheMultiStore() storetypes.CacheMultiStore { + inner := rms.MultiStore.CacheMultiStore() + return &RecordingCacheMultiStore{ + MultiStore: inner, + inner: inner, + recorder: rms.recorder, + excludedKeys: rms.excludedKeys, + } +} + +func (rms *RecordingMultiStore) CacheMultiStoreWithVersion(version int64) (storetypes.CacheMultiStore, error) { + inner, err := rms.MultiStore.CacheMultiStoreWithVersion(version) + if err != nil { + return nil, err + } + return &RecordingCacheMultiStore{ + MultiStore: inner, + inner: inner, + recorder: rms.recorder, + excludedKeys: rms.excludedKeys, + }, nil +} + +// RecordingCacheMultiStore wraps a CacheMultiStore with recording, so that +// writes through branched contexts (e.g. bank module SendCoins) are captured +// by the cross-module recording. +type RecordingCacheMultiStore struct { + storetypes.MultiStore // embed MultiStore interface for read-through + inner storetypes.CacheMultiStore + recorder *api.EcallRecorder + excludedKeys map[string]bool +} + +func (rcms *RecordingCacheMultiStore) Write() { + rcms.inner.Write() +} + +func (rcms *RecordingCacheMultiStore) GetKVStore(key storetypes.StoreKey) storetypes.KVStore { + inner := rcms.inner.GetKVStore(key) + if rcms.excludedKeys[key.Name()] { + return inner + } + return &RecordingKVStore{ + KVStore: inner, + storeKey: key.Name(), + recorder: rcms.recorder, + } +} + +func (rcms *RecordingCacheMultiStore) CacheMultiStore() storetypes.CacheMultiStore { + return rcms.inner.CacheMultiStore() +} + +func (rcms *RecordingCacheMultiStore) CacheMultiStoreWithVersion(version int64) (storetypes.CacheMultiStore, error) { + return rcms.inner.CacheMultiStoreWithVersion(version) +} + +func (rms *RecordingMultiStore) CacheWrap() storetypes.CacheWrap { + return rms.MultiStore.CacheWrap() +} + +func (rms *RecordingMultiStore) CacheWrapWithTrace(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap { + return rms.MultiStore.CacheWrapWithTrace(w, tc) +} + +func (rms *RecordingMultiStore) GetStoreType() storetypes.StoreType { + return rms.MultiStore.GetStoreType() +} + +func (rms *RecordingMultiStore) TracingEnabled() bool { + return rms.MultiStore.TracingEnabled() +} + +func (rms *RecordingMultiStore) SetTracer(w io.Writer) storetypes.MultiStore { + rms.MultiStore.SetTracer(w) + return rms +} + +func (rms *RecordingMultiStore) SetTracingContext(tc storetypes.TraceContext) storetypes.MultiStore { + rms.MultiStore.SetTracingContext(tc) + return rms +} + +func (rms *RecordingMultiStore) LatestVersion() int64 { + return rms.MultiStore.LatestVersion() +} + +// RecordingKVStore wraps a KVStore and records all Set/Delete operations as +// CrossModuleOps on the EcallRecorder. +type RecordingKVStore struct { + storetypes.KVStore + storeKey string + recorder *api.EcallRecorder +} + +func (rks *RecordingKVStore) Set(key, value []byte) { + rks.KVStore.Set(key, value) + rks.recorder.AppendCrossModuleOp(api.CrossModuleOp{ + StoreKey: rks.storeKey, + Key: cloneBytes(key), + Value: cloneBytes(value), + IsDelete: false, + }) +} + +func (rks *RecordingKVStore) Delete(key []byte) { + rks.KVStore.Delete(key) + rks.recorder.AppendCrossModuleOp(api.CrossModuleOp{ + StoreKey: rks.storeKey, + Key: cloneBytes(key), + IsDelete: true, + }) +} + +// Read-through methods (no recording needed) +func (rks *RecordingKVStore) Get(key []byte) []byte { + return rks.KVStore.Get(key) +} + +func (rks *RecordingKVStore) Has(key []byte) bool { + return rks.KVStore.Has(key) +} + +func (rks *RecordingKVStore) Iterator(start, end []byte) storetypes.Iterator { + return rks.KVStore.Iterator(start, end) +} + +func (rks *RecordingKVStore) ReverseIterator(start, end []byte) storetypes.Iterator { + return rks.KVStore.ReverseIterator(start, end) +} + +func (rks *RecordingKVStore) GetStoreType() storetypes.StoreType { + return rks.KVStore.GetStoreType() +} + +func (rks *RecordingKVStore) CacheWrap() storetypes.CacheWrap { + return rks.KVStore.CacheWrap() +} + +func (rks *RecordingKVStore) CacheWrapWithTrace(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap { + return rks.KVStore.CacheWrapWithTrace(w, tc) +} + +// cloneBytes returns a copy of a byte slice, or nil if the input is nil. +func cloneBytes(b []byte) []byte { + if b == nil { + return nil + } + c := make([]byte, len(b)) + copy(c, b) + return c +} + +// ApplyCrossModuleOps replays recorded cross-module mutations on the real multistore. +// Called by the keeper after wasmer.Execute() in replay mode to apply mutations that +// query handlers made to other modules' stores during the SGX execution (e.g., +// distribution reward withdrawals triggered by staking queries). +// +// storeKeys maps store key names (e.g. "distribution") to the app's registered +// StoreKey instances. CacheMultiStore uses pointer identity for its internal map +// lookups, so we MUST pass the exact registered pointer — creating a new +// *KVStoreKey with the same name will silently write to an orphan store. +func ApplyCrossModuleOps(ms storetypes.MultiStore, storeKeys map[string]storetypes.StoreKey, ops []api.CrossModuleOp) { + for _, op := range ops { + sk, ok := storeKeys[op.StoreKey] + if !ok { + panic(fmt.Sprintf("ApplyCrossModuleOps: unknown store key %q in cross-module op", op.StoreKey)) + } + store := ms.GetKVStore(sk) + if op.IsDelete { + store.Delete(op.Key) + } else { + store.Set(op.Key, op.Value) + } + } +} diff --git a/x/compute/internal/keeper/relay.go b/x/compute/internal/keeper/relay.go index 21657a1ca5..7a9e929f44 100644 --- a/x/compute/internal/keeper/relay.go +++ b/x/compute/internal/keeper/relay.go @@ -6,9 +6,13 @@ import ( "time" errorsmod "cosmossdk.io/errors" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" sdktxsigning "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/scrtlabs/SecretNetwork/go-cosmwasm/api" wasmTypes "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types" v1types "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types/v1" @@ -50,13 +54,41 @@ func (k Keeper) ibcContractCall(ctx sdk.Context, ) // prepare querier + recorder := api.GetRecorder() + querierCtx := ctx + if recorder.IsSGXMode() { + recordingMS := NewRecordingMultiStore(ctx.MultiStore(), recorder, nil) + querierCtx = ctx.WithMultiStore(recordingMS) + } + querier := QueryHandler{ - Ctx: ctx, + Ctx: querierCtx, Plugins: k.queryPlugins, + Caller: contractAddress, } gas := gasForContract(ctx) - res, gasUsed, err := k.wasmer.Execute(codeInfo.CodeHash, env, msgBz, prefixStore, cosmwasmAPI, querier, ctx.GasMeter(), gas, sigInfo, callType) + + // In replay mode, use a gas-free store so ApplyOps doesn't charge + // native SDK gas on the real gas meter. + var storeForExecution prefix.Store + if api.GetRecorder().IsReplayMode() { + replayCtx := ctx.WithGasMeter(storetypes.NewInfiniteGasMeter()) + prefixStoreKey := types.GetContractStorePrefixKey(contractAddress) + storeForExecution = prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(replayCtx)), prefixStoreKey) + } else { + storeForExecution = prefixStore + } + + res, gasUsed, err := k.wasmer.Execute(codeInfo.CodeHash, env, msgBz, storeForExecution, cosmwasmAPI, querier, ctx.GasMeter(), gas, sigInfo, callType) + + if api.GetRecorder().IsReplayMode() { + crossOps := api.GetRecorder().GetAndClearPendingCrossModuleOps() + if len(crossOps) > 0 { + ApplyCrossModuleOps(ctx.MultiStore(), k.storeKeys, crossOps) + } + } + consumeGas(ctx, gasUsed) return res, err diff --git a/x/compute/internal/types/query.pb.go b/x/compute/internal/types/query.pb.go index 38d1ede5f6..0d1de28b35 100644 --- a/x/compute/internal/types/query.pb.go +++ b/x/compute/internal/types/query.pb.go @@ -957,485 +957,959 @@ func (m *QueryAuthorizedAdminUpdateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAuthorizedAdminUpdateResponse proto.InternalMessageInfo -func init() { - proto.RegisterType((*ParamsRequest)(nil), "secret.compute.v1beta1.ParamsRequest") - proto.RegisterType((*ParamsResponse)(nil), "secret.compute.v1beta1.ParamsResponse") - proto.RegisterType((*QuerySecretContractRequest)(nil), "secret.compute.v1beta1.QuerySecretContractRequest") - proto.RegisterType((*QueryByLabelRequest)(nil), "secret.compute.v1beta1.QueryByLabelRequest") - proto.RegisterType((*QueryByContractAddressRequest)(nil), "secret.compute.v1beta1.QueryByContractAddressRequest") - proto.RegisterType((*QueryByCodeIdRequest)(nil), "secret.compute.v1beta1.QueryByCodeIdRequest") - proto.RegisterType((*QuerySecretContractResponse)(nil), "secret.compute.v1beta1.QuerySecretContractResponse") - proto.RegisterType((*QueryContractInfoResponse)(nil), "secret.compute.v1beta1.QueryContractInfoResponse") - proto.RegisterType((*ContractInfoWithAddress)(nil), "secret.compute.v1beta1.ContractInfoWithAddress") - proto.RegisterType((*QueryContractsByCodeIdResponse)(nil), "secret.compute.v1beta1.QueryContractsByCodeIdResponse") - proto.RegisterType((*CodeInfoResponse)(nil), "secret.compute.v1beta1.CodeInfoResponse") - proto.RegisterType((*QueryCodeResponse)(nil), "secret.compute.v1beta1.QueryCodeResponse") - proto.RegisterType((*QueryCodesResponse)(nil), "secret.compute.v1beta1.QueryCodesResponse") - proto.RegisterType((*QueryContractAddressResponse)(nil), "secret.compute.v1beta1.QueryContractAddressResponse") - proto.RegisterType((*QueryContractLabelResponse)(nil), "secret.compute.v1beta1.QueryContractLabelResponse") - proto.RegisterType((*QueryCodeHashResponse)(nil), "secret.compute.v1beta1.QueryCodeHashResponse") - proto.RegisterType((*DecryptedAnswer)(nil), "secret.compute.v1beta1.DecryptedAnswer") - proto.RegisterType((*DecryptedAnswers)(nil), "secret.compute.v1beta1.DecryptedAnswers") - proto.RegisterType((*QueryContractHistoryRequest)(nil), "secret.compute.v1beta1.QueryContractHistoryRequest") - proto.RegisterType((*QueryContractHistoryResponse)(nil), "secret.compute.v1beta1.QueryContractHistoryResponse") - proto.RegisterType((*QueryAuthorizedMigrationRequest)(nil), "secret.compute.v1beta1.QueryAuthorizedMigrationRequest") - proto.RegisterType((*QueryAuthorizedMigrationResponse)(nil), "secret.compute.v1beta1.QueryAuthorizedMigrationResponse") - proto.RegisterType((*QueryAuthorizedAdminUpdateRequest)(nil), "secret.compute.v1beta1.QueryAuthorizedAdminUpdateRequest") - proto.RegisterType((*QueryAuthorizedAdminUpdateResponse)(nil), "secret.compute.v1beta1.QueryAuthorizedAdminUpdateResponse") +// QueryEcallRecordRequest is the request type for the Query/EcallRecord RPC method +type QueryEcallRecordRequest struct { + // Block height to query ecall record for + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` } -func init() { - proto.RegisterFile("secret/compute/v1beta1/query.proto", fileDescriptor_7735281c5fa969d4) +func (m *QueryEcallRecordRequest) Reset() { *m = QueryEcallRecordRequest{} } +func (m *QueryEcallRecordRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEcallRecordRequest) ProtoMessage() {} +func (*QueryEcallRecordRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{24} } - -var fileDescriptor_7735281c5fa969d4 = []byte{ - // 1479 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0x4b, 0x8f, 0x13, 0xc7, - 0x16, 0x9e, 0x86, 0x79, 0x30, 0x67, 0x5e, 0x50, 0x0c, 0x83, 0x31, 0x5c, 0x1b, 0xfa, 0xf2, 0x18, - 0x5e, 0x6e, 0x6c, 0xb8, 0xc0, 0x9d, 0xcb, 0x95, 0xe2, 0x19, 0x46, 0x62, 0xa2, 0x61, 0x02, 0x26, - 0x51, 0xa4, 0x88, 0xc8, 0x2a, 0x77, 0x17, 0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 0x78, 0x45, 0x85, 0xf5, 0x35, 0xc4, 0xba, 0x44, 0xae, 0x77, - 0x60, 0xa5, 0xa1, 0x56, 0xb1, 0x16, 0xa8, 0xc5, 0xd1, 0xf8, 0x42, 0x83, 0x43, 0xb1, 0x3d, 0x02, - 0xf9, 0xef, 0x80, 0xa8, 0x3a, 0xfb, 0x94, 0xe4, 0xd2, 0x6e, 0x54, 0x55, 0x48, 0x2b, 0x18, 0xd2, - 0xff, 0xc9, 0xff, 0x7a, 0x85, 0x84, 0x0d, 0x4b, 0xb1, 0x81, 0x9a, 0x31, 0x51, 0x2d, 0xdf, 0x7f, - 0xf6, 0x6b, 0x6a, 0xe4, 0xe9, 0x76, 0x4a, 0x7b, 0xb6, 0x9d, 0xd2, 0x9e, 0x6f, 0xa7, 0xb4, 0x5f, - 0xb6, 0x53, 0xda, 0xc7, 0xaf, 0x52, 0x23, 0xcf, 0x5f, 0xa5, 0x46, 0x7e, 0x7e, 0x95, 0x1a, 0x79, - 0x67, 0xa9, 0x6c, 0x8b, 0x4a, 0xa3, 0xe4, 0x23, 0x34, 0xb8, 0xe9, 0x89, 0x2a, 0x2d, 0x71, 0x43, - 0x96, 0xc9, 0x0d, 0x26, 0x36, 0x5d, 0xef, 0xa1, 0xb1, 0x15, 0x22, 0xf0, 0xfb, 0x62, 0xcf, 0xa1, - 0x55, 0xf9, 0x8f, 0xab, 0x34, 0x8e, 0x75, 0xe6, 0xf2, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x37, - 0xfa, 0xf2, 0xdf, 0x5c, 0x13, 0x00, 0x00, +func (m *QueryEcallRecordRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (this *ParamsRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*ParamsRequest) - if !ok { - that2, ok := that.(ParamsRequest) - if ok { - that1 = &that2 - } else { - return false +func (m *QueryEcallRecordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEcallRecordRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - return true } -func (this *QuerySecretContractRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEcallRecordRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEcallRecordRequest.Merge(m, src) +} +func (m *QueryEcallRecordRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryEcallRecordRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEcallRecordRequest.DiscardUnknown(m) +} - that1, ok := that.(*QuerySecretContractRequest) - if !ok { - that2, ok := that.(QuerySecretContractRequest) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ContractAddress != that1.ContractAddress { - return false - } - if !bytes.Equal(this.Query, that1.Query) { - return false - } - return true +var xxx_messageInfo_QueryEcallRecordRequest proto.InternalMessageInfo + +// QueryEcallRecordResponse is the response type for the Query/EcallRecord RPC method +type QueryEcallRecordResponse struct { + // Block height + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + // Random seed from SubmitBlockSignatures (32 bytes) + RandomSeed []byte `protobuf:"bytes,2,opt,name=random_seed,json=randomSeed,proto3" json:"random_seed,omitempty"` + // Validator set evidence from SubmitBlockSignatures (32 bytes) + ValidatorSetEvidence []byte `protobuf:"bytes,3,opt,name=validator_set_evidence,json=validatorSetEvidence,proto3" json:"validator_set_evidence,omitempty"` } -func (this *QueryByLabelRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*QueryByLabelRequest) - if !ok { - that2, ok := that.(QueryByLabelRequest) - if ok { - that1 = &that2 - } else { - return false +func (m *QueryEcallRecordResponse) Reset() { *m = QueryEcallRecordResponse{} } +func (m *QueryEcallRecordResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEcallRecordResponse) ProtoMessage() {} +func (*QueryEcallRecordResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{25} +} +func (m *QueryEcallRecordResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEcallRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEcallRecordResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Label != that1.Label { - return false - } - return true } -func (this *QueryByContractAddressRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEcallRecordResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEcallRecordResponse.Merge(m, src) +} +func (m *QueryEcallRecordResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEcallRecordResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEcallRecordResponse.DiscardUnknown(m) +} - that1, ok := that.(*QueryByContractAddressRequest) - if !ok { - that2, ok := that.(QueryByContractAddressRequest) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryEcallRecordResponse proto.InternalMessageInfo + +// QueryEcallRecordsRequest is the request type for the Query/EcallRecords RPC method +type QueryEcallRecordsRequest struct { + // Start block height (inclusive) + StartHeight int64 `protobuf:"varint,1,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + // End block height (inclusive) + EndHeight int64 `protobuf:"varint,2,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` +} + +func (m *QueryEcallRecordsRequest) Reset() { *m = QueryEcallRecordsRequest{} } +func (m *QueryEcallRecordsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEcallRecordsRequest) ProtoMessage() {} +func (*QueryEcallRecordsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{26} +} +func (m *QueryEcallRecordsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEcallRecordsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEcallRecordsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ContractAddress != that1.ContractAddress { - return false - } - return true } -func (this *QueryByCodeIdRequest) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEcallRecordsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEcallRecordsRequest.Merge(m, src) +} +func (m *QueryEcallRecordsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryEcallRecordsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEcallRecordsRequest.DiscardUnknown(m) +} - that1, ok := that.(*QueryByCodeIdRequest) - if !ok { - that2, ok := that.(QueryByCodeIdRequest) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryEcallRecordsRequest proto.InternalMessageInfo + +// QueryEcallRecordsResponse is the response type for the Query/EcallRecords RPC method +type QueryEcallRecordsResponse struct { + // List of ecall records + Records []QueryEcallRecordResponse `protobuf:"bytes,1,rep,name=records,proto3" json:"records"` +} + +func (m *QueryEcallRecordsResponse) Reset() { *m = QueryEcallRecordsResponse{} } +func (m *QueryEcallRecordsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEcallRecordsResponse) ProtoMessage() {} +func (*QueryEcallRecordsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{27} +} +func (m *QueryEcallRecordsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEcallRecordsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEcallRecordsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.CodeId != that1.CodeId { - return false - } - return true } -func (this *QuerySecretContractResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEcallRecordsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEcallRecordsResponse.Merge(m, src) +} +func (m *QueryEcallRecordsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEcallRecordsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEcallRecordsResponse.DiscardUnknown(m) +} - that1, ok := that.(*QuerySecretContractResponse) - if !ok { - that2, ok := that.(QuerySecretContractResponse) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryEcallRecordsResponse proto.InternalMessageInfo + +// QueryEncryptedSeedRequest is the request type for the Query/EncryptedSeed RPC method +type QueryEncryptedSeedRequest struct { + // Certificate hash (hex encoded sha256 of certificate) + CertHash string `protobuf:"bytes,1,opt,name=cert_hash,json=certHash,proto3" json:"cert_hash,omitempty"` + // Block height at which the seed was recorded (required for per-height keying) + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryEncryptedSeedRequest) Reset() { *m = QueryEncryptedSeedRequest{} } +func (m *QueryEncryptedSeedRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEncryptedSeedRequest) ProtoMessage() {} +func (*QueryEncryptedSeedRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{28} +} +func (m *QueryEncryptedSeedRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEncryptedSeedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEncryptedSeedRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Data, that1.Data) { - return false - } - return true } -func (this *QueryContractInfoResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEncryptedSeedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEncryptedSeedRequest.Merge(m, src) +} +func (m *QueryEncryptedSeedRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryEncryptedSeedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEncryptedSeedRequest.DiscardUnknown(m) +} - that1, ok := that.(*QueryContractInfoResponse) - if !ok { - that2, ok := that.(QueryContractInfoResponse) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryEncryptedSeedRequest proto.InternalMessageInfo + +// QueryEncryptedSeedResponse is the response type for the Query/EncryptedSeed RPC method +type QueryEncryptedSeedResponse struct { + // Encrypted seed data + EncryptedSeed []byte `protobuf:"bytes,1,opt,name=encrypted_seed,json=encryptedSeed,proto3" json:"encrypted_seed,omitempty"` +} + +func (m *QueryEncryptedSeedResponse) Reset() { *m = QueryEncryptedSeedResponse{} } +func (m *QueryEncryptedSeedResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEncryptedSeedResponse) ProtoMessage() {} +func (*QueryEncryptedSeedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{29} +} +func (m *QueryEncryptedSeedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEncryptedSeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEncryptedSeedResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ContractAddress != that1.ContractAddress { - return false - } - if !this.ContractInfo.Equal(that1.ContractInfo) { - return false - } - return true } -func (this *ContractInfoWithAddress) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryEncryptedSeedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEncryptedSeedResponse.Merge(m, src) +} +func (m *QueryEncryptedSeedResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEncryptedSeedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEncryptedSeedResponse.DiscardUnknown(m) +} - that1, ok := that.(*ContractInfoWithAddress) - if !ok { - that2, ok := that.(ContractInfoWithAddress) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryEncryptedSeedResponse proto.InternalMessageInfo + +// StorageOp represents a single storage operation (Set or Delete) +type StorageOp struct { + // True if this is a delete operation, false for set + IsDelete bool `protobuf:"varint,1,opt,name=is_delete,json=isDelete,proto3" json:"is_delete,omitempty"` + // Storage key + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // Storage value (empty for delete operations) + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *StorageOp) Reset() { *m = StorageOp{} } +func (m *StorageOp) String() string { return proto.CompactTextString(m) } +func (*StorageOp) ProtoMessage() {} +func (*StorageOp) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{30} +} +func (m *StorageOp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StorageOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_StorageOp.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ContractAddress != that1.ContractAddress { - return false - } - if !this.ContractInfo.Equal(that1.ContractInfo) { - return false - } - return true } -func (this *QueryContractsByCodeIdResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *StorageOp) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageOp.Merge(m, src) +} +func (m *StorageOp) XXX_Size() int { + return m.Size() +} +func (m *StorageOp) XXX_DiscardUnknown() { + xxx_messageInfo_StorageOp.DiscardUnknown(m) +} - that1, ok := that.(*QueryContractsByCodeIdResponse) - if !ok { - that2, ok := that.(QueryContractsByCodeIdResponse) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_StorageOp proto.InternalMessageInfo + +// CrossModuleOp represents a storage operation on a different module's store +type CrossModuleOp struct { + // The store key identifying the module (e.g., "bank", "staking") + StoreKey string `protobuf:"bytes,1,opt,name=store_key,json=storeKey,proto3" json:"store_key,omitempty"` + // Storage key within the module's store + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // Storage value (empty for delete operations) + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + // True if this is a delete operation, false for set + IsDelete bool `protobuf:"varint,4,opt,name=is_delete,json=isDelete,proto3" json:"is_delete,omitempty"` +} + +func (m *CrossModuleOp) Reset() { *m = CrossModuleOp{} } +func (m *CrossModuleOp) String() string { return proto.CompactTextString(m) } +func (*CrossModuleOp) ProtoMessage() {} +func (*CrossModuleOp) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{31} +} +func (m *CrossModuleOp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CrossModuleOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CrossModuleOp.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.ContractInfos) != len(that1.ContractInfos) { - return false - } - for i := range this.ContractInfos { - if !this.ContractInfos[i].Equal(&that1.ContractInfos[i]) { - return false +} +func (m *CrossModuleOp) XXX_Merge(src proto.Message) { + xxx_messageInfo_CrossModuleOp.Merge(m, src) +} +func (m *CrossModuleOp) XXX_Size() int { + return m.Size() +} +func (m *CrossModuleOp) XXX_DiscardUnknown() { + xxx_messageInfo_CrossModuleOp.DiscardUnknown(m) +} + +var xxx_messageInfo_CrossModuleOp proto.InternalMessageInfo + +// ExecutionTraceData is a single execution trace with its index +type ExecutionTraceData struct { + // Execution index within the block + Index int64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + // List of storage operations performed during execution + Ops []StorageOp `protobuf:"bytes,2,rep,name=ops,proto3" json:"ops"` + // Return value from the contract execution + Result []byte `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` + // Gas used during execution (compute gas from WASM) + GasUsed uint64 `protobuf:"varint,4,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` + // Gas consumed by callbacks (store operations) during execution + CallbackGas uint64 `protobuf:"varint,7,opt,name=callback_gas,json=callbackGas,proto3" json:"callback_gas,omitempty"` + // Whether the execution resulted in an error + HasError bool `protobuf:"varint,5,opt,name=has_error,json=hasError,proto3" json:"has_error,omitempty"` + // Error message (if has_error is true) + ErrorMsg string `protobuf:"bytes,6,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` + // List of cross-module storage operations (e.g., bank balance changes) + CrossOps []CrossModuleOp `protobuf:"bytes,8,rep,name=cross_ops,json=crossOps,proto3" json:"cross_ops"` +} + +func (m *ExecutionTraceData) Reset() { *m = ExecutionTraceData{} } +func (m *ExecutionTraceData) String() string { return proto.CompactTextString(m) } +func (*ExecutionTraceData) ProtoMessage() {} +func (*ExecutionTraceData) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{32} +} +func (m *ExecutionTraceData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExecutionTraceData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExecutionTraceData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - return true } -func (this *CodeInfoResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *ExecutionTraceData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExecutionTraceData.Merge(m, src) +} +func (m *ExecutionTraceData) XXX_Size() int { + return m.Size() +} +func (m *ExecutionTraceData) XXX_DiscardUnknown() { + xxx_messageInfo_ExecutionTraceData.DiscardUnknown(m) +} - that1, ok := that.(*CodeInfoResponse) - if !ok { - that2, ok := that.(CodeInfoResponse) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.CodeId != that1.CodeId { - return false - } - if this.Creator != that1.Creator { - return false - } - if this.CodeHash != that1.CodeHash { - return false - } - if this.Source != that1.Source { - return false - } - if this.Builder != that1.Builder { - return false - } - return true +var xxx_messageInfo_ExecutionTraceData proto.InternalMessageInfo + +// QueryBlockTracesRequest is the request type for the Query/BlockTraces RPC method +type QueryBlockTracesRequest struct { + // Block height to query traces for + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` } -func (this *QueryCodeResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*QueryCodeResponse) - if !ok { - that2, ok := that.(QueryCodeResponse) - if ok { - that1 = &that2 - } else { - return false +func (m *QueryBlockTracesRequest) Reset() { *m = QueryBlockTracesRequest{} } +func (m *QueryBlockTracesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBlockTracesRequest) ProtoMessage() {} +func (*QueryBlockTracesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{33} +} +func (m *QueryBlockTracesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlockTracesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlockTracesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.CodeInfoResponse.Equal(that1.CodeInfoResponse) { - return false - } - if !bytes.Equal(this.Wasm, that1.Wasm) { - return false - } - return true } -func (this *QueryCodesResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryBlockTracesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlockTracesRequest.Merge(m, src) +} +func (m *QueryBlockTracesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBlockTracesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlockTracesRequest.DiscardUnknown(m) +} - that1, ok := that.(*QueryCodesResponse) - if !ok { - that2, ok := that.(QueryCodesResponse) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.CodeInfos) != len(that1.CodeInfos) { - return false - } - for i := range this.CodeInfos { - if !this.CodeInfos[i].Equal(&that1.CodeInfos[i]) { - return false +var xxx_messageInfo_QueryBlockTracesRequest proto.InternalMessageInfo + +// QueryBlockTracesResponse is the response type for the Query/BlockTraces RPC method +type QueryBlockTracesResponse struct { + // All execution traces for the block + Traces []ExecutionTraceData `protobuf:"bytes,1,rep,name=traces,proto3" json:"traces"` +} + +func (m *QueryBlockTracesResponse) Reset() { *m = QueryBlockTracesResponse{} } +func (m *QueryBlockTracesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBlockTracesResponse) ProtoMessage() {} +func (*QueryBlockTracesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{34} +} +func (m *QueryBlockTracesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlockTracesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlockTracesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - return true } -func (this *QueryContractAddressResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *QueryBlockTracesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlockTracesResponse.Merge(m, src) +} +func (m *QueryBlockTracesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBlockTracesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlockTracesResponse.DiscardUnknown(m) +} - that1, ok := that.(*QueryContractAddressResponse) - if !ok { - that2, ok := that.(QueryContractAddressResponse) - if ok { - that1 = &that2 - } else { - return false +var xxx_messageInfo_QueryBlockTracesResponse proto.InternalMessageInfo + +// QueryMachineIDProofRequest is the request type for the Query/MachineIDProof RPC method +type QueryMachineIDProofRequest struct { + // Block height where the machine ID was approved + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + // Machine ID (hex encoded) + MachineId string `protobuf:"bytes,2,opt,name=machine_id,json=machineId,proto3" json:"machine_id,omitempty"` +} + +func (m *QueryMachineIDProofRequest) Reset() { *m = QueryMachineIDProofRequest{} } +func (m *QueryMachineIDProofRequest) String() string { return proto.CompactTextString(m) } +func (*QueryMachineIDProofRequest) ProtoMessage() {} +func (*QueryMachineIDProofRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{35} +} +func (m *QueryMachineIDProofRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMachineIDProofRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMachineIDProofRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ContractAddress != that1.ContractAddress { - return false - } - return true } -func (this *QueryContractLabelResponse) Equal(that interface{}) bool { +func (m *QueryMachineIDProofRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMachineIDProofRequest.Merge(m, src) +} +func (m *QueryMachineIDProofRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryMachineIDProofRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMachineIDProofRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMachineIDProofRequest proto.InternalMessageInfo + +// QueryMachineIDProofResponse is the response type for the Query/MachineIDProof RPC method +type QueryMachineIDProofResponse struct { + // Proof bytes (32 bytes) + Proof []byte `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` +} + +func (m *QueryMachineIDProofResponse) Reset() { *m = QueryMachineIDProofResponse{} } +func (m *QueryMachineIDProofResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMachineIDProofResponse) ProtoMessage() {} +func (*QueryMachineIDProofResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{36} +} +func (m *QueryMachineIDProofResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMachineIDProofResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMachineIDProofResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryMachineIDProofResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMachineIDProofResponse.Merge(m, src) +} +func (m *QueryMachineIDProofResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryMachineIDProofResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMachineIDProofResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMachineIDProofResponse proto.InternalMessageInfo + +// QueryAnalyzeCodeRequest is the request type for the Query/AnalyzeCode RPC method +type QueryAnalyzeCodeRequest struct { + // Code hash (raw bytes, typically 32 bytes SHA256) + CodeHash []byte `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` +} + +func (m *QueryAnalyzeCodeRequest) Reset() { *m = QueryAnalyzeCodeRequest{} } +func (m *QueryAnalyzeCodeRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAnalyzeCodeRequest) ProtoMessage() {} +func (*QueryAnalyzeCodeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{37} +} +func (m *QueryAnalyzeCodeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAnalyzeCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAnalyzeCodeRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAnalyzeCodeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAnalyzeCodeRequest.Merge(m, src) +} +func (m *QueryAnalyzeCodeRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAnalyzeCodeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAnalyzeCodeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAnalyzeCodeRequest proto.InternalMessageInfo + +// QueryAnalyzeCodeResponse is the response type for the Query/AnalyzeCode RPC method +type QueryAnalyzeCodeResponse struct { + // Whether the code has IBC entry points (ibc_channel_open, ibc_channel_connect, etc.) + HasIbcEntryPoints bool `protobuf:"varint,1,opt,name=has_ibc_entry_points,json=hasIbcEntryPoints,proto3" json:"has_ibc_entry_points,omitempty"` + // Comma-separated list of required features (e.g., "staking", "stargate") + RequiredFeatures string `protobuf:"bytes,2,opt,name=required_features,json=requiredFeatures,proto3" json:"required_features,omitempty"` +} + +func (m *QueryAnalyzeCodeResponse) Reset() { *m = QueryAnalyzeCodeResponse{} } +func (m *QueryAnalyzeCodeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAnalyzeCodeResponse) ProtoMessage() {} +func (*QueryAnalyzeCodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{38} +} +func (m *QueryAnalyzeCodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAnalyzeCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAnalyzeCodeResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryAnalyzeCodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAnalyzeCodeResponse.Merge(m, src) +} +func (m *QueryAnalyzeCodeResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAnalyzeCodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAnalyzeCodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAnalyzeCodeResponse proto.InternalMessageInfo + +// CreateResultData stores the outcome of a single MsgStoreCode execution +type CreateResultData struct { + // SHA256 of the original WASM bytecode + WasmHash []byte `protobuf:"bytes,1,opt,name=wasm_hash,json=wasmHash,proto3" json:"wasm_hash,omitempty"` + // Code hash computed by the enclave (empty on error) + CodeHash []byte `protobuf:"bytes,2,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` + // Whether the enclave rejected the code + HasError bool `protobuf:"varint,3,opt,name=has_error,json=hasError,proto3" json:"has_error,omitempty"` + // Error message (if has_error is true) + ErrorMsg string `protobuf:"bytes,4,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` +} + +func (m *CreateResultData) Reset() { *m = CreateResultData{} } +func (m *CreateResultData) String() string { return proto.CompactTextString(m) } +func (*CreateResultData) ProtoMessage() {} +func (*CreateResultData) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{39} +} +func (m *CreateResultData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateResultData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CreateResultData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CreateResultData) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateResultData.Merge(m, src) +} +func (m *CreateResultData) XXX_Size() int { + return m.Size() +} +func (m *CreateResultData) XXX_DiscardUnknown() { + xxx_messageInfo_CreateResultData.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateResultData proto.InternalMessageInfo + +// QueryBlockCreateResultsRequest is the request type for the Query/BlockCreateResults RPC method +type QueryBlockCreateResultsRequest struct { + // Block height to query Create results for + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryBlockCreateResultsRequest) Reset() { *m = QueryBlockCreateResultsRequest{} } +func (m *QueryBlockCreateResultsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBlockCreateResultsRequest) ProtoMessage() {} +func (*QueryBlockCreateResultsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{40} +} +func (m *QueryBlockCreateResultsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlockCreateResultsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlockCreateResultsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryBlockCreateResultsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlockCreateResultsRequest.Merge(m, src) +} +func (m *QueryBlockCreateResultsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBlockCreateResultsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlockCreateResultsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBlockCreateResultsRequest proto.InternalMessageInfo + +// QueryBlockCreateResultsResponse is the response type for the Query/BlockCreateResults RPC method +type QueryBlockCreateResultsResponse struct { + // All Create results for the block + Results []CreateResultData `protobuf:"bytes,1,rep,name=results,proto3" json:"results"` +} + +func (m *QueryBlockCreateResultsResponse) Reset() { *m = QueryBlockCreateResultsResponse{} } +func (m *QueryBlockCreateResultsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBlockCreateResultsResponse) ProtoMessage() {} +func (*QueryBlockCreateResultsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{41} +} +func (m *QueryBlockCreateResultsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBlockCreateResultsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBlockCreateResultsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryBlockCreateResultsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBlockCreateResultsResponse.Merge(m, src) +} +func (m *QueryBlockCreateResultsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBlockCreateResultsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBlockCreateResultsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBlockCreateResultsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*ParamsRequest)(nil), "secret.compute.v1beta1.ParamsRequest") + proto.RegisterType((*ParamsResponse)(nil), "secret.compute.v1beta1.ParamsResponse") + proto.RegisterType((*QuerySecretContractRequest)(nil), "secret.compute.v1beta1.QuerySecretContractRequest") + proto.RegisterType((*QueryByLabelRequest)(nil), "secret.compute.v1beta1.QueryByLabelRequest") + proto.RegisterType((*QueryByContractAddressRequest)(nil), "secret.compute.v1beta1.QueryByContractAddressRequest") + proto.RegisterType((*QueryByCodeIdRequest)(nil), "secret.compute.v1beta1.QueryByCodeIdRequest") + proto.RegisterType((*QuerySecretContractResponse)(nil), "secret.compute.v1beta1.QuerySecretContractResponse") + proto.RegisterType((*QueryContractInfoResponse)(nil), "secret.compute.v1beta1.QueryContractInfoResponse") + proto.RegisterType((*ContractInfoWithAddress)(nil), "secret.compute.v1beta1.ContractInfoWithAddress") + proto.RegisterType((*QueryContractsByCodeIdResponse)(nil), "secret.compute.v1beta1.QueryContractsByCodeIdResponse") + proto.RegisterType((*CodeInfoResponse)(nil), "secret.compute.v1beta1.CodeInfoResponse") + proto.RegisterType((*QueryCodeResponse)(nil), "secret.compute.v1beta1.QueryCodeResponse") + proto.RegisterType((*QueryCodesResponse)(nil), "secret.compute.v1beta1.QueryCodesResponse") + proto.RegisterType((*QueryContractAddressResponse)(nil), "secret.compute.v1beta1.QueryContractAddressResponse") + proto.RegisterType((*QueryContractLabelResponse)(nil), "secret.compute.v1beta1.QueryContractLabelResponse") + proto.RegisterType((*QueryCodeHashResponse)(nil), "secret.compute.v1beta1.QueryCodeHashResponse") + proto.RegisterType((*DecryptedAnswer)(nil), "secret.compute.v1beta1.DecryptedAnswer") + proto.RegisterType((*DecryptedAnswers)(nil), "secret.compute.v1beta1.DecryptedAnswers") + proto.RegisterType((*QueryContractHistoryRequest)(nil), "secret.compute.v1beta1.QueryContractHistoryRequest") + proto.RegisterType((*QueryContractHistoryResponse)(nil), "secret.compute.v1beta1.QueryContractHistoryResponse") + proto.RegisterType((*QueryAuthorizedMigrationRequest)(nil), "secret.compute.v1beta1.QueryAuthorizedMigrationRequest") + proto.RegisterType((*QueryAuthorizedMigrationResponse)(nil), "secret.compute.v1beta1.QueryAuthorizedMigrationResponse") + proto.RegisterType((*QueryAuthorizedAdminUpdateRequest)(nil), "secret.compute.v1beta1.QueryAuthorizedAdminUpdateRequest") + proto.RegisterType((*QueryAuthorizedAdminUpdateResponse)(nil), "secret.compute.v1beta1.QueryAuthorizedAdminUpdateResponse") + proto.RegisterType((*QueryEcallRecordRequest)(nil), "secret.compute.v1beta1.QueryEcallRecordRequest") + proto.RegisterType((*QueryEcallRecordResponse)(nil), "secret.compute.v1beta1.QueryEcallRecordResponse") + proto.RegisterType((*QueryEcallRecordsRequest)(nil), "secret.compute.v1beta1.QueryEcallRecordsRequest") + proto.RegisterType((*QueryEcallRecordsResponse)(nil), "secret.compute.v1beta1.QueryEcallRecordsResponse") + proto.RegisterType((*QueryEncryptedSeedRequest)(nil), "secret.compute.v1beta1.QueryEncryptedSeedRequest") + proto.RegisterType((*QueryEncryptedSeedResponse)(nil), "secret.compute.v1beta1.QueryEncryptedSeedResponse") + proto.RegisterType((*StorageOp)(nil), "secret.compute.v1beta1.StorageOp") + proto.RegisterType((*CrossModuleOp)(nil), "secret.compute.v1beta1.CrossModuleOp") + proto.RegisterType((*ExecutionTraceData)(nil), "secret.compute.v1beta1.ExecutionTraceData") + proto.RegisterType((*QueryBlockTracesRequest)(nil), "secret.compute.v1beta1.QueryBlockTracesRequest") + proto.RegisterType((*QueryBlockTracesResponse)(nil), "secret.compute.v1beta1.QueryBlockTracesResponse") + proto.RegisterType((*QueryMachineIDProofRequest)(nil), "secret.compute.v1beta1.QueryMachineIDProofRequest") + proto.RegisterType((*QueryMachineIDProofResponse)(nil), "secret.compute.v1beta1.QueryMachineIDProofResponse") + proto.RegisterType((*QueryAnalyzeCodeRequest)(nil), "secret.compute.v1beta1.QueryAnalyzeCodeRequest") + proto.RegisterType((*QueryAnalyzeCodeResponse)(nil), "secret.compute.v1beta1.QueryAnalyzeCodeResponse") + proto.RegisterType((*CreateResultData)(nil), "secret.compute.v1beta1.CreateResultData") + proto.RegisterType((*QueryBlockCreateResultsRequest)(nil), "secret.compute.v1beta1.QueryBlockCreateResultsRequest") + proto.RegisterType((*QueryBlockCreateResultsResponse)(nil), "secret.compute.v1beta1.QueryBlockCreateResultsResponse") +} + +func init() { + proto.RegisterFile("secret/compute/v1beta1/query.proto", fileDescriptor_7735281c5fa969d4) +} + +var fileDescriptor_7735281c5fa969d4 = []byte{ + // 2355 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0x4b, 0x6c, 0x1c, 0x49, + 0x19, 0x76, 0xfb, 0x3d, 0xe5, 0x47, 0x92, 0x5a, 0xc7, 0x71, 0x26, 0x9b, 0x71, 0x52, 0x6c, 0x12, + 0x27, 0xd9, 0x4c, 0xc7, 0x4e, 0xc8, 0x8b, 0x45, 0x60, 0x3b, 0x86, 0x18, 0xf2, 0xf0, 0x8e, 0x77, + 0x85, 0x84, 0x82, 0x5a, 0x35, 0xdd, 0x95, 0x99, 0x96, 0x67, 0xba, 0x27, 0x5d, 0x35, 0xb6, 0x67, + 0x23, 0x73, 0xe0, 0x80, 0xe0, 0x86, 0xc4, 0x22, 0xb4, 0xe2, 0xb2, 0x27, 0x58, 0x81, 0x84, 0xc4, + 0x75, 0x25, 0xc4, 0x35, 0x42, 0x1c, 0x22, 0xe5, 0xc2, 0x29, 0x82, 0x84, 0x03, 0xe2, 0xce, 0x1d, + 0xd5, 0x5f, 0xd5, 0x3d, 0xdd, 0x33, 0x3d, 0xd3, 0xe3, 0x70, 0xd8, 0xdb, 0x74, 0xd5, 0xff, 0xf8, + 0xfe, 0x47, 0xfd, 0xf5, 0xff, 0x35, 0x88, 0x70, 0x66, 0x07, 0x4c, 0x98, 0xb6, 0x5f, 0x6f, 0x34, + 0x05, 0x33, 0x77, 0x97, 0xcb, 0x4c, 0xd0, 0x65, 0xf3, 0x69, 0x93, 0x05, 0xad, 0x62, 0x23, 0xf0, + 0x85, 0x8f, 0xe7, 0x15, 0x4d, 0x51, 0xd3, 0x14, 0x35, 0x4d, 0x7e, 0xae, 0xe2, 0x57, 0x7c, 0x20, + 0x31, 0xe5, 0x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0b, 0x7c, 0xed, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xae, 0xfe, 0x00, 0x23, 0x26, + 0x1f, 0x00, 0x00, +} + +func (this *ParamsRequest) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryContractLabelResponse) + that1, ok := that.(*ParamsRequest) if !ok { - that2, ok := that.(QueryContractLabelResponse) + that2, ok := that.(ParamsRequest) if ok { that1 = &that2 } else { @@ -1447,19 +1921,43 @@ func (this *QueryContractLabelResponse) Equal(that interface{}) bool { } else if this == nil { return false } - if this.Label != that1.Label { + return true +} +func (this *QuerySecretContractRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QuerySecretContractRequest) + if !ok { + that2, ok := that.(QuerySecretContractRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ContractAddress != that1.ContractAddress { + return false + } + if !bytes.Equal(this.Query, that1.Query) { return false } return true } -func (this *QueryCodeHashResponse) Equal(that interface{}) bool { +func (this *QueryByLabelRequest) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryCodeHashResponse) + that1, ok := that.(*QueryByLabelRequest) if !ok { - that2, ok := that.(QueryCodeHashResponse) + that2, ok := that.(QueryByLabelRequest) if ok { that1 = &that2 } else { @@ -1471,19 +1969,19 @@ func (this *QueryCodeHashResponse) Equal(that interface{}) bool { } else if this == nil { return false } - if this.CodeHash != that1.CodeHash { + if this.Label != that1.Label { return false } return true } -func (this *QueryAuthorizedMigrationRequest) Equal(that interface{}) bool { +func (this *QueryByContractAddressRequest) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryAuthorizedMigrationRequest) + that1, ok := that.(*QueryByContractAddressRequest) if !ok { - that2, ok := that.(QueryAuthorizedMigrationRequest) + that2, ok := that.(QueryByContractAddressRequest) if ok { that1 = &that2 } else { @@ -1500,14 +1998,14 @@ func (this *QueryAuthorizedMigrationRequest) Equal(that interface{}) bool { } return true } -func (this *QueryAuthorizedMigrationResponse) Equal(that interface{}) bool { +func (this *QueryByCodeIdRequest) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryAuthorizedMigrationResponse) + that1, ok := that.(*QueryByCodeIdRequest) if !ok { - that2, ok := that.(QueryAuthorizedMigrationResponse) + that2, ok := that.(QueryByCodeIdRequest) if ok { that1 = &that2 } else { @@ -1519,19 +2017,19 @@ func (this *QueryAuthorizedMigrationResponse) Equal(that interface{}) bool { } else if this == nil { return false } - if this.NewCodeID != that1.NewCodeID { + if this.CodeId != that1.CodeId { return false } return true } -func (this *QueryAuthorizedAdminUpdateRequest) Equal(that interface{}) bool { +func (this *QuerySecretContractResponse) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryAuthorizedAdminUpdateRequest) + that1, ok := that.(*QuerySecretContractResponse) if !ok { - that2, ok := that.(QueryAuthorizedAdminUpdateRequest) + that2, ok := that.(QuerySecretContractResponse) if ok { that1 = &that2 } else { @@ -1543,19 +2041,19 @@ func (this *QueryAuthorizedAdminUpdateRequest) Equal(that interface{}) bool { } else if this == nil { return false } - if this.ContractAddress != that1.ContractAddress { + if !bytes.Equal(this.Data, that1.Data) { return false } return true } -func (this *QueryAuthorizedAdminUpdateResponse) Equal(that interface{}) bool { +func (this *QueryContractInfoResponse) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*QueryAuthorizedAdminUpdateResponse) + that1, ok := that.(*QueryContractInfoResponse) if !ok { - that2, ok := that.(QueryAuthorizedAdminUpdateResponse) + that2, ok := that.(QueryContractInfoResponse) if ok { that1 = &that2 } else { @@ -1567,1351 +2065,1714 @@ func (this *QueryAuthorizedAdminUpdateResponse) Equal(that interface{}) bool { } else if this == nil { return false } - if this.NewAdmin != that1.NewAdmin { + if this.ContractAddress != that1.ContractAddress { + return false + } + if !this.ContractInfo.Equal(that1.ContractInfo) { return false } return true } +func (this *ContractInfoWithAddress) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Query contract info by address - ContractInfo(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractInfoResponse, error) - // Query code info by id - ContractsByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryContractsByCodeIdResponse, error) - // Query secret contract - QuerySecretContract(ctx context.Context, in *QuerySecretContractRequest, opts ...grpc.CallOption) (*QuerySecretContractResponse, error) - // Query a specific contract code by id - Code(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) - // Query all contract codes on-chain - Codes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error) - // Query code hash by contract address - CodeHashByContractAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) - // Query code hash by code id - CodeHashByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) - // Query contract label by address - LabelByAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractLabelResponse, error) - // Query contract address by label - AddressByLabel(ctx context.Context, in *QueryByLabelRequest, opts ...grpc.CallOption) (*QueryContractAddressResponse, error) - // ContractHistory gets the contract code history - ContractHistory(ctx context.Context, in *QueryContractHistoryRequest, opts ...grpc.CallOption) (*QueryContractHistoryResponse, error) - // Params defines a gRPC query method that returns the compute - // module's parameters. - Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) - // Query authorized migration for a contract - AuthorizedMigration(ctx context.Context, in *QueryAuthorizedMigrationRequest, opts ...grpc.CallOption) (*QueryAuthorizedMigrationResponse, error) - // Query authorized admin update for a contract - AuthorizedAdminUpdate(ctx context.Context, in *QueryAuthorizedAdminUpdateRequest, opts ...grpc.CallOption) (*QueryAuthorizedAdminUpdateResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) ContractInfo(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractInfoResponse, error) { - out := new(QueryContractInfoResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractInfo", in, out, opts...) - if err != nil { - return nil, err + that1, ok := that.(*ContractInfoWithAddress) + if !ok { + that2, ok := that.(ContractInfoWithAddress) + if ok { + that1 = &that2 + } else { + return false + } } - return out, nil -} - -func (c *queryClient) ContractsByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryContractsByCodeIdResponse, error) { - out := new(QueryContractsByCodeIdResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractsByCodeId", in, out, opts...) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return out, nil -} - -func (c *queryClient) QuerySecretContract(ctx context.Context, in *QuerySecretContractRequest, opts ...grpc.CallOption) (*QuerySecretContractResponse, error) { - out := new(QuerySecretContractResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/QuerySecretContract", in, out, opts...) - if err != nil { - return nil, err + if this.ContractAddress != that1.ContractAddress { + return false } - return out, nil -} - -func (c *queryClient) Code(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) { - out := new(QueryCodeResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Code", in, out, opts...) - if err != nil { - return nil, err + if !this.ContractInfo.Equal(that1.ContractInfo) { + return false } - return out, nil + return true } - -func (c *queryClient) Codes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error) { - out := new(QueryCodesResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Codes", in, out, opts...) - if err != nil { - return nil, err +func (this *QueryContractsByCodeIdResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return out, nil -} -func (c *queryClient) CodeHashByContractAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) { - out := new(QueryCodeHashResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/CodeHashByContractAddress", in, out, opts...) - if err != nil { - return nil, err + that1, ok := that.(*QueryContractsByCodeIdResponse) + if !ok { + that2, ok := that.(QueryContractsByCodeIdResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return out, nil -} - -func (c *queryClient) CodeHashByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) { - out := new(QueryCodeHashResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/CodeHashByCodeId", in, out, opts...) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return out, nil -} - -func (c *queryClient) LabelByAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractLabelResponse, error) { - out := new(QueryContractLabelResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/LabelByAddress", in, out, opts...) - if err != nil { - return nil, err + if len(this.ContractInfos) != len(that1.ContractInfos) { + return false } - return out, nil -} - -func (c *queryClient) AddressByLabel(ctx context.Context, in *QueryByLabelRequest, opts ...grpc.CallOption) (*QueryContractAddressResponse, error) { - out := new(QueryContractAddressResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AddressByLabel", in, out, opts...) - if err != nil { - return nil, err + for i := range this.ContractInfos { + if !this.ContractInfos[i].Equal(&that1.ContractInfos[i]) { + return false + } } - return out, nil + return true } - -func (c *queryClient) ContractHistory(ctx context.Context, in *QueryContractHistoryRequest, opts ...grpc.CallOption) (*QueryContractHistoryResponse, error) { - out := new(QueryContractHistoryResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractHistory", in, out, opts...) - if err != nil { - return nil, err +func (this *CodeInfoResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return out, nil -} -func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { - out := new(ParamsResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err + that1, ok := that.(*CodeInfoResponse) + if !ok { + that2, ok := that.(CodeInfoResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return out, nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.CodeId != that1.CodeId { + return false + } + if this.Creator != that1.Creator { + return false + } + if this.CodeHash != that1.CodeHash { + return false + } + if this.Source != that1.Source { + return false + } + if this.Builder != that1.Builder { + return false + } + return true } +func (this *QueryCodeResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (c *queryClient) AuthorizedMigration(ctx context.Context, in *QueryAuthorizedMigrationRequest, opts ...grpc.CallOption) (*QueryAuthorizedMigrationResponse, error) { - out := new(QueryAuthorizedMigrationResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AuthorizedMigration", in, out, opts...) - if err != nil { - return nil, err + that1, ok := that.(*QueryCodeResponse) + if !ok { + that2, ok := that.(QueryCodeResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return out, nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.CodeInfoResponse.Equal(that1.CodeInfoResponse) { + return false + } + if !bytes.Equal(this.Wasm, that1.Wasm) { + return false + } + return true } +func (this *QueryCodesResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (c *queryClient) AuthorizedAdminUpdate(ctx context.Context, in *QueryAuthorizedAdminUpdateRequest, opts ...grpc.CallOption) (*QueryAuthorizedAdminUpdateResponse, error) { - out := new(QueryAuthorizedAdminUpdateResponse) - err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AuthorizedAdminUpdate", in, out, opts...) - if err != nil { - return nil, err + that1, ok := that.(*QueryCodesResponse) + if !ok { + that2, ok := that.(QueryCodesResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return out, nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.CodeInfos) != len(that1.CodeInfos) { + return false + } + for i := range this.CodeInfos { + if !this.CodeInfos[i].Equal(&that1.CodeInfos[i]) { + return false + } + } + return true } +func (this *QueryContractAddressResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -// QueryServer is the server API for Query service. -type QueryServer interface { - // Query contract info by address - ContractInfo(context.Context, *QueryByContractAddressRequest) (*QueryContractInfoResponse, error) - // Query code info by id - ContractsByCodeId(context.Context, *QueryByCodeIdRequest) (*QueryContractsByCodeIdResponse, error) - // Query secret contract - QuerySecretContract(context.Context, *QuerySecretContractRequest) (*QuerySecretContractResponse, error) - // Query a specific contract code by id - Code(context.Context, *QueryByCodeIdRequest) (*QueryCodeResponse, error) - // Query all contract codes on-chain - Codes(context.Context, *emptypb.Empty) (*QueryCodesResponse, error) - // Query code hash by contract address - CodeHashByContractAddress(context.Context, *QueryByContractAddressRequest) (*QueryCodeHashResponse, error) - // Query code hash by code id - CodeHashByCodeId(context.Context, *QueryByCodeIdRequest) (*QueryCodeHashResponse, error) - // Query contract label by address - LabelByAddress(context.Context, *QueryByContractAddressRequest) (*QueryContractLabelResponse, error) - // Query contract address by label - AddressByLabel(context.Context, *QueryByLabelRequest) (*QueryContractAddressResponse, error) - // ContractHistory gets the contract code history - ContractHistory(context.Context, *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) - // Params defines a gRPC query method that returns the compute - // module's parameters. - Params(context.Context, *ParamsRequest) (*ParamsResponse, error) - // Query authorized migration for a contract - AuthorizedMigration(context.Context, *QueryAuthorizedMigrationRequest) (*QueryAuthorizedMigrationResponse, error) - // Query authorized admin update for a contract - AuthorizedAdminUpdate(context.Context, *QueryAuthorizedAdminUpdateRequest) (*QueryAuthorizedAdminUpdateResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) ContractInfo(ctx context.Context, req *QueryByContractAddressRequest) (*QueryContractInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ContractInfo not implemented") -} -func (*UnimplementedQueryServer) ContractsByCodeId(ctx context.Context, req *QueryByCodeIdRequest) (*QueryContractsByCodeIdResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ContractsByCodeId not implemented") -} -func (*UnimplementedQueryServer) QuerySecretContract(ctx context.Context, req *QuerySecretContractRequest) (*QuerySecretContractResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QuerySecretContract not implemented") -} -func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryByCodeIdRequest) (*QueryCodeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Code not implemented") -} -func (*UnimplementedQueryServer) Codes(ctx context.Context, req *emptypb.Empty) (*QueryCodesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Codes not implemented") -} -func (*UnimplementedQueryServer) CodeHashByContractAddress(ctx context.Context, req *QueryByContractAddressRequest) (*QueryCodeHashResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CodeHashByContractAddress not implemented") -} -func (*UnimplementedQueryServer) CodeHashByCodeId(ctx context.Context, req *QueryByCodeIdRequest) (*QueryCodeHashResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CodeHashByCodeId not implemented") -} -func (*UnimplementedQueryServer) LabelByAddress(ctx context.Context, req *QueryByContractAddressRequest) (*QueryContractLabelResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LabelByAddress not implemented") -} -func (*UnimplementedQueryServer) AddressByLabel(ctx context.Context, req *QueryByLabelRequest) (*QueryContractAddressResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddressByLabel not implemented") -} -func (*UnimplementedQueryServer) ContractHistory(ctx context.Context, req *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ContractHistory not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) AuthorizedMigration(ctx context.Context, req *QueryAuthorizedMigrationRequest) (*QueryAuthorizedMigrationResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthorizedMigration not implemented") -} -func (*UnimplementedQueryServer) AuthorizedAdminUpdate(ctx context.Context, req *QueryAuthorizedAdminUpdateRequest) (*QueryAuthorizedAdminUpdateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthorizedAdminUpdate not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_ContractInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByContractAddressRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ContractInfo(ctx, in) + that1, ok := that.(*QueryContractAddressResponse) + if !ok { + that2, ok := that.(QueryContractAddressResponse) + if ok { + that1 = &that2 + } else { + return false + } } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/ContractInfo", + if that1 == nil { + return this == nil + } else if this == nil { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ContractInfo(ctx, req.(*QueryByContractAddressRequest)) + if this.ContractAddress != that1.ContractAddress { + return false } - return interceptor(ctx, in, info, handler) + return true } - -func _Query_ContractsByCodeId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByCodeIdRequest) - if err := dec(in); err != nil { - return nil, err +func (this *QueryContractLabelResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if interceptor == nil { - return srv.(QueryServer).ContractsByCodeId(ctx, in) + + that1, ok := that.(*QueryContractLabelResponse) + if !ok { + that2, ok := that.(QueryContractLabelResponse) + if ok { + that1 = &that2 + } else { + return false + } } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/ContractsByCodeId", + if that1 == nil { + return this == nil + } else if this == nil { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ContractsByCodeId(ctx, req.(*QueryByCodeIdRequest)) + if this.Label != that1.Label { + return false } - return interceptor(ctx, in, info, handler) + return true } - -func _Query_QuerySecretContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySecretContractRequest) - if err := dec(in); err != nil { - return nil, err +func (this *QueryCodeHashResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if interceptor == nil { - return srv.(QueryServer).QuerySecretContract(ctx, in) + + that1, ok := that.(*QueryCodeHashResponse) + if !ok { + that2, ok := that.(QueryCodeHashResponse) + if ok { + that1 = &that2 + } else { + return false + } } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/QuerySecretContract", + if that1 == nil { + return this == nil + } else if this == nil { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QuerySecretContract(ctx, req.(*QuerySecretContractRequest)) + if this.CodeHash != that1.CodeHash { + return false } - return interceptor(ctx, in, info, handler) + return true } - -func _Query_Code_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByCodeIdRequest) - if err := dec(in); err != nil { - return nil, err +func (this *QueryAuthorizedMigrationRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if interceptor == nil { - return srv.(QueryServer).Code(ctx, in) + + that1, ok := that.(*QueryAuthorizedMigrationRequest) + if !ok { + that2, ok := that.(QueryAuthorizedMigrationRequest) + if ok { + that1 = &that2 + } else { + return false + } } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/Code", + if that1 == nil { + return this == nil + } else if this == nil { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Code(ctx, req.(*QueryByCodeIdRequest)) + if this.ContractAddress != that1.ContractAddress { + return false } - return interceptor(ctx, in, info, handler) + return true } - -func _Query_Codes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) - if err := dec(in); err != nil { - return nil, err +func (this *QueryAuthorizedMigrationResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if interceptor == nil { - return srv.(QueryServer).Codes(ctx, in) + + that1, ok := that.(*QueryAuthorizedMigrationResponse) + if !ok { + that2, ok := that.(QueryAuthorizedMigrationResponse) + if ok { + that1 = &that2 + } else { + return false + } } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/Codes", + if that1 == nil { + return this == nil + } else if this == nil { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Codes(ctx, req.(*emptypb.Empty)) + if this.NewCodeID != that1.NewCodeID { + return false } - return interceptor(ctx, in, info, handler) + return true } +func (this *QueryAuthorizedAdminUpdateRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_CodeHashByContractAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByContractAddressRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryAuthorizedAdminUpdateRequest) + if !ok { + that2, ok := that.(QueryAuthorizedAdminUpdateRequest) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).CodeHashByContractAddress(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/CodeHashByContractAddress", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CodeHashByContractAddress(ctx, req.(*QueryByContractAddressRequest)) + if this.ContractAddress != that1.ContractAddress { + return false } - return interceptor(ctx, in, info, handler) + return true } +func (this *QueryAuthorizedAdminUpdateResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_CodeHashByCodeId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByCodeIdRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryAuthorizedAdminUpdateResponse) + if !ok { + that2, ok := that.(QueryAuthorizedAdminUpdateResponse) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).CodeHashByCodeId(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/CodeHashByCodeId", + if this.NewAdmin != that1.NewAdmin { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).CodeHashByCodeId(ctx, req.(*QueryByCodeIdRequest)) + return true +} +func (this *QueryEcallRecordRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return interceptor(ctx, in, info, handler) + + that1, ok := that.(*QueryEcallRecordRequest) + if !ok { + that2, ok := that.(QueryEcallRecordRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Height != that1.Height { + return false + } + return true } +func (this *QueryEcallRecordResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_LabelByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByContractAddressRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryEcallRecordResponse) + if !ok { + that2, ok := that.(QueryEcallRecordResponse) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).LabelByAddress(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/LabelByAddress", + if this.Height != that1.Height { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LabelByAddress(ctx, req.(*QueryByContractAddressRequest)) + if !bytes.Equal(this.RandomSeed, that1.RandomSeed) { + return false } - return interceptor(ctx, in, info, handler) + if !bytes.Equal(this.ValidatorSetEvidence, that1.ValidatorSetEvidence) { + return false + } + return true } +func (this *QueryEcallRecordsRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_AddressByLabel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryByLabelRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryEcallRecordsRequest) + if !ok { + that2, ok := that.(QueryEcallRecordsRequest) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).AddressByLabel(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/AddressByLabel", + if this.StartHeight != that1.StartHeight { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AddressByLabel(ctx, req.(*QueryByLabelRequest)) + if this.EndHeight != that1.EndHeight { + return false } - return interceptor(ctx, in, info, handler) + return true } +func (this *QueryEcallRecordsResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_ContractHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryContractHistoryRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryEcallRecordsResponse) + if !ok { + that2, ok := that.(QueryEcallRecordsResponse) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).ContractHistory(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/ContractHistory", + if len(this.Records) != len(that1.Records) { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ContractHistory(ctx, req.(*QueryContractHistoryRequest)) + for i := range this.Records { + if !this.Records[i].Equal(&that1.Records[i]) { + return false + } } - return interceptor(ctx, in, info, handler) + return true } +func (this *QueryEncryptedSeedRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ParamsRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*QueryEncryptedSeedRequest) + if !ok { + that2, ok := that.(QueryEncryptedSeedRequest) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/Params", + if this.CertHash != that1.CertHash { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) + if this.Height != that1.Height { + return false } - return interceptor(ctx, in, info, handler) + return true } - -func _Query_AuthorizedMigration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAuthorizedMigrationRequest) - if err := dec(in); err != nil { - return nil, err +func (this *QueryEncryptedSeedResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil } - if interceptor == nil { - return srv.(QueryServer).AuthorizedMigration(ctx, in) + + that1, ok := that.(*QueryEncryptedSeedResponse) + if !ok { + that2, ok := that.(QueryEncryptedSeedResponse) + if ok { + that1 = &that2 + } else { + return false + } } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/AuthorizedMigration", + if that1 == nil { + return this == nil + } else if this == nil { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AuthorizedMigration(ctx, req.(*QueryAuthorizedMigrationRequest)) + if !bytes.Equal(this.EncryptedSeed, that1.EncryptedSeed) { + return false } - return interceptor(ctx, in, info, handler) + return true } +func (this *StorageOp) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func _Query_AuthorizedAdminUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAuthorizedAdminUpdateRequest) - if err := dec(in); err != nil { - return nil, err + that1, ok := that.(*StorageOp) + if !ok { + that2, ok := that.(StorageOp) + if ok { + that1 = &that2 + } else { + return false + } } - if interceptor == nil { - return srv.(QueryServer).AuthorizedAdminUpdate(ctx, in) + if that1 == nil { + return this == nil + } else if this == nil { + return false } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/secret.compute.v1beta1.Query/AuthorizedAdminUpdate", + if this.IsDelete != that1.IsDelete { + return false } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AuthorizedAdminUpdate(ctx, req.(*QueryAuthorizedAdminUpdateRequest)) + if !bytes.Equal(this.Key, that1.Key) { + return false } - return interceptor(ctx, in, info, handler) + if !bytes.Equal(this.Value, that1.Value) { + return false + } + return true } +func (this *CrossModuleOp) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "secret.compute.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ContractInfo", - Handler: _Query_ContractInfo_Handler, - }, - { - MethodName: "ContractsByCodeId", - Handler: _Query_ContractsByCodeId_Handler, - }, - { - MethodName: "QuerySecretContract", - Handler: _Query_QuerySecretContract_Handler, - }, - { - MethodName: "Code", - Handler: _Query_Code_Handler, - }, - { - MethodName: "Codes", - Handler: _Query_Codes_Handler, - }, - { - MethodName: "CodeHashByContractAddress", - Handler: _Query_CodeHashByContractAddress_Handler, - }, - { - MethodName: "CodeHashByCodeId", - Handler: _Query_CodeHashByCodeId_Handler, - }, - { - MethodName: "LabelByAddress", - Handler: _Query_LabelByAddress_Handler, - }, - { - MethodName: "AddressByLabel", - Handler: _Query_AddressByLabel_Handler, - }, - { - MethodName: "ContractHistory", - Handler: _Query_ContractHistory_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "AuthorizedMigration", - Handler: _Query_AuthorizedMigration_Handler, - }, - { - MethodName: "AuthorizedAdminUpdate", - Handler: _Query_AuthorizedAdminUpdate_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "secret/compute/v1beta1/query.proto", -} - -func (m *ParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + that1, ok := that.(*CrossModuleOp) + if !ok { + that2, ok := that.(CrossModuleOp) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil -} - -func (m *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return dAtA[:n], nil -} - -func (m *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + if this.StoreKey != that1.StoreKey { + return false + } + if !bytes.Equal(this.Key, that1.Key) { + return false + } + if !bytes.Equal(this.Value, that1.Value) { + return false + } + if this.IsDelete != that1.IsDelete { + return false + } + return true } +func (this *ExecutionTraceData) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + that1, ok := that.(*ExecutionTraceData) + if !ok { + that2, ok := that.(ExecutionTraceData) + if ok { + that1 = &that2 + } else { + return false } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Index != that1.Index { + return false + } + if len(this.Ops) != len(that1.Ops) { + return false + } + for i := range this.Ops { + if !this.Ops[i].Equal(&that1.Ops[i]) { + return false + } + } + if !bytes.Equal(this.Result, that1.Result) { + return false + } + if this.GasUsed != that1.GasUsed { + return false + } + if this.CallbackGas != that1.CallbackGas { + return false + } + if this.HasError != that1.HasError { + return false + } + if this.ErrorMsg != that1.ErrorMsg { + return false + } + if len(this.CrossOps) != len(that1.CrossOps) { + return false + } + for i := range this.CrossOps { + if !this.CrossOps[i].Equal(&that1.CrossOps[i]) { + return false + } + } + return true } +func (this *QueryBlockTracesRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QuerySecretContractRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + that1, ok := that.(*QueryBlockTracesRequest) + if !ok { + that2, ok := that.(QueryBlockTracesRequest) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Height != that1.Height { + return false + } + return true } +func (this *QueryBlockTracesResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QuerySecretContractRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + that1, ok := that.(*QueryBlockTracesResponse) + if !ok { + that2, ok := that.(QueryBlockTracesResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Traces) != len(that1.Traces) { + return false + } + for i := range this.Traces { + if !this.Traces[i].Equal(&that1.Traces[i]) { + return false + } + } + return true } +func (this *QueryMachineIDProofRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QuerySecretContractRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Query) > 0 { - i -= len(m.Query) - copy(dAtA[i:], m.Query) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Query))) - i-- - dAtA[i] = 0x12 + that1, ok := that.(*QueryMachineIDProofRequest) + if !ok { + that2, ok := that.(QueryMachineIDProofRequest) + if ok { + that1 = &that2 + } else { + return false + } } - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return len(dAtA) - i, nil + if this.Height != that1.Height { + return false + } + if this.MachineId != that1.MachineId { + return false + } + return true } +func (this *QueryMachineIDProofResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryByLabelRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + that1, ok := that.(*QueryMachineIDProofResponse) + if !ok { + that2, ok := that.(QueryMachineIDProofResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Proof, that1.Proof) { + return false + } + return true } +func (this *QueryAnalyzeCodeRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryByLabelRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + that1, ok := that.(*QueryAnalyzeCodeRequest) + if !ok { + that2, ok := that.(QueryAnalyzeCodeRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.CodeHash, that1.CodeHash) { + return false + } + return true } +func (this *QueryAnalyzeCodeResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryByLabelRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Label) > 0 { - i -= len(m.Label) - copy(dAtA[i:], m.Label) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Label))) - i-- - dAtA[i] = 0xa + that1, ok := that.(*QueryAnalyzeCodeResponse) + if !ok { + that2, ok := that.(QueryAnalyzeCodeResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return len(dAtA) - i, nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.HasIbcEntryPoints != that1.HasIbcEntryPoints { + return false + } + if this.RequiredFeatures != that1.RequiredFeatures { + return false + } + return true } +func (this *CreateResultData) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryByContractAddressRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + that1, ok := that.(*CreateResultData) + if !ok { + that2, ok := that.(CreateResultData) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.WasmHash, that1.WasmHash) { + return false + } + if !bytes.Equal(this.CodeHash, that1.CodeHash) { + return false + } + if this.HasError != that1.HasError { + return false + } + if this.ErrorMsg != that1.ErrorMsg { + return false + } + return true } +func (this *QueryBlockCreateResultsRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryByContractAddressRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + that1, ok := that.(*QueryBlockCreateResultsRequest) + if !ok { + that2, ok := that.(QueryBlockCreateResultsRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Height != that1.Height { + return false + } + return true } +func (this *QueryBlockCreateResultsResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *QueryByContractAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa + that1, ok := that.(*QueryBlockCreateResultsResponse) + if !ok { + that2, ok := that.(QueryBlockCreateResultsResponse) + if ok { + that1 = &that2 + } else { + return false + } } - return len(dAtA) - i, nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Results) != len(that1.Results) { + return false + } + for i := range this.Results { + if !this.Results[i].Equal(&that1.Results[i]) { + return false + } + } + return true } -func (m *QueryByCodeIdRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Query contract info by address + ContractInfo(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractInfoResponse, error) + // Query code info by id + ContractsByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryContractsByCodeIdResponse, error) + // Query secret contract + QuerySecretContract(ctx context.Context, in *QuerySecretContractRequest, opts ...grpc.CallOption) (*QuerySecretContractResponse, error) + // Query a specific contract code by id + Code(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) + // Query all contract codes on-chain + Codes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error) + // Query code hash by contract address + CodeHashByContractAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) + // Query code hash by code id + CodeHashByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) + // Query contract label by address + LabelByAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractLabelResponse, error) + // Query contract address by label + AddressByLabel(ctx context.Context, in *QueryByLabelRequest, opts ...grpc.CallOption) (*QueryContractAddressResponse, error) + // ContractHistory gets the contract code history + ContractHistory(ctx context.Context, in *QueryContractHistoryRequest, opts ...grpc.CallOption) (*QueryContractHistoryResponse, error) + // Params defines a gRPC query method that returns the compute + // module's parameters. + Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) + // Query authorized migration for a contract + AuthorizedMigration(ctx context.Context, in *QueryAuthorizedMigrationRequest, opts ...grpc.CallOption) (*QueryAuthorizedMigrationResponse, error) + // Query authorized admin update for a contract + AuthorizedAdminUpdate(ctx context.Context, in *QueryAuthorizedAdminUpdateRequest, opts ...grpc.CallOption) (*QueryAuthorizedAdminUpdateResponse, error) + // Query ecall record for a specific block height (for non-SGX node sync) + EcallRecord(ctx context.Context, in *QueryEcallRecordRequest, opts ...grpc.CallOption) (*QueryEcallRecordResponse, error) + // Query ecall records for a range of block heights (batch sync) + EcallRecords(ctx context.Context, in *QueryEcallRecordsRequest, opts ...grpc.CallOption) (*QueryEcallRecordsResponse, error) + // Query encrypted seed by certificate hash (for non-SGX node sync) + EncryptedSeed(ctx context.Context, in *QueryEncryptedSeedRequest, opts ...grpc.CallOption) (*QueryEncryptedSeedResponse, error) + // Query all execution traces for a block (batch fetch for non-SGX node sync) + BlockTraces(ctx context.Context, in *QueryBlockTracesRequest, opts ...grpc.CallOption) (*QueryBlockTracesResponse, error) + // Query machine ID proof for a specific block height and machine ID (for non-SGX node sync) + MachineIDProof(ctx context.Context, in *QueryMachineIDProofRequest, opts ...grpc.CallOption) (*QueryMachineIDProofResponse, error) + // Analyze code to determine IBC entry points and required features + AnalyzeCode(ctx context.Context, in *QueryAnalyzeCodeRequest, opts ...grpc.CallOption) (*QueryAnalyzeCodeResponse, error) + // Query all Create (MsgStoreCode) results for a block (for non-SGX node sync) + BlockCreateResults(ctx context.Context, in *QueryBlockCreateResultsRequest, opts ...grpc.CallOption) (*QueryBlockCreateResultsResponse, error) } -func (m *QueryByCodeIdRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +type queryClient struct { + cc grpc1.ClientConn } -func (m *QueryByCodeIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CodeId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.CodeId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} } -func (m *QuerySecretContractResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) ContractInfo(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractInfoResponse, error) { + out := new(QueryContractInfoResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractInfo", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QuerySecretContractResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) ContractsByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryContractsByCodeIdResponse, error) { + out := new(QueryContractsByCodeIdResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractsByCodeId", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QuerySecretContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0xa +func (c *queryClient) QuerySecretContract(ctx context.Context, in *QuerySecretContractRequest, opts ...grpc.CallOption) (*QuerySecretContractResponse, error) { + out := new(QuerySecretContractResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/QuerySecretContract", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryContractInfoResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Code(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeResponse, error) { + out := new(QueryCodeResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Code", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryContractInfoResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Codes(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*QueryCodesResponse, error) { + out := new(QueryCodesResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Codes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryContractInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ContractInfo != nil { - { - size, err := m.ContractInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa +func (c *queryClient) CodeHashByContractAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) { + out := new(QueryCodeHashResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/CodeHashByContractAddress", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *ContractInfoWithAddress) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) CodeHashByCodeId(ctx context.Context, in *QueryByCodeIdRequest, opts ...grpc.CallOption) (*QueryCodeHashResponse, error) { + out := new(QueryCodeHashResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/CodeHashByCodeId", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *ContractInfoWithAddress) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *ContractInfoWithAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ContractInfo != nil { - { - size, err := m.ContractInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa +func (c *queryClient) LabelByAddress(ctx context.Context, in *QueryByContractAddressRequest, opts ...grpc.CallOption) (*QueryContractLabelResponse, error) { + out := new(QueryContractLabelResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/LabelByAddress", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryContractsByCodeIdResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) AddressByLabel(ctx context.Context, in *QueryByLabelRequest, opts ...grpc.CallOption) (*QueryContractAddressResponse, error) { + out := new(QueryContractAddressResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AddressByLabel", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryContractsByCodeIdResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + return out, nil } -func (m *QueryContractsByCodeIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractInfos) > 0 { - for iNdEx := len(m.ContractInfos) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ContractInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } +func (c *queryClient) ContractHistory(ctx context.Context, in *QueryContractHistoryRequest, opts ...grpc.CallOption) (*QueryContractHistoryResponse, error) { + out := new(QueryContractHistoryResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/ContractHistory", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *CodeInfoResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { + out := new(ParamsResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/Params", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *CodeInfoResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) AuthorizedMigration(ctx context.Context, in *QueryAuthorizedMigrationRequest, opts ...grpc.CallOption) (*QueryAuthorizedMigrationResponse, error) { + out := new(QueryAuthorizedMigrationResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AuthorizedMigration", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *CodeInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Builder) > 0 { - i -= len(m.Builder) - copy(dAtA[i:], m.Builder) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Builder))) - i-- - dAtA[i] = 0x2a - } - if len(m.Source) > 0 { - i -= len(m.Source) - copy(dAtA[i:], m.Source) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Source))) - i-- - dAtA[i] = 0x22 - } - if len(m.CodeHash) > 0 { - i -= len(m.CodeHash) - copy(dAtA[i:], m.CodeHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) - i-- - dAtA[i] = 0x1a - } - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0x12 - } - if m.CodeId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.CodeId)) - i-- - dAtA[i] = 0x8 +func (c *queryClient) AuthorizedAdminUpdate(ctx context.Context, in *QueryAuthorizedAdminUpdateRequest, opts ...grpc.CallOption) (*QueryAuthorizedAdminUpdateResponse, error) { + out := new(QueryAuthorizedAdminUpdateResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AuthorizedAdminUpdate", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryCodeResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) EcallRecord(ctx context.Context, in *QueryEcallRecordRequest, opts ...grpc.CallOption) (*QueryEcallRecordResponse, error) { + out := new(QueryEcallRecordResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/EcallRecord", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryCodeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) EcallRecords(ctx context.Context, in *QueryEcallRecordsRequest, opts ...grpc.CallOption) (*QueryEcallRecordsResponse, error) { + out := new(QueryEcallRecordsResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/EcallRecords", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Wasm) > 0 { - i -= len(m.Wasm) - copy(dAtA[i:], m.Wasm) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Wasm))) - i-- - dAtA[i] = 0x12 - } - if m.CodeInfoResponse != nil { - { - size, err := m.CodeInfoResponse.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa +func (c *queryClient) EncryptedSeed(ctx context.Context, in *QueryEncryptedSeedRequest, opts ...grpc.CallOption) (*QueryEncryptedSeedResponse, error) { + out := new(QueryEncryptedSeedResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/EncryptedSeed", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryCodesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) BlockTraces(ctx context.Context, in *QueryBlockTracesRequest, opts ...grpc.CallOption) (*QueryBlockTracesResponse, error) { + out := new(QueryBlockTracesResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/BlockTraces", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryCodesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) MachineIDProof(ctx context.Context, in *QueryMachineIDProofRequest, opts ...grpc.CallOption) (*QueryMachineIDProofResponse, error) { + out := new(QueryMachineIDProofResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/MachineIDProof", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (m *QueryCodesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CodeInfos) > 0 { - for iNdEx := len(m.CodeInfos) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CodeInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } +func (c *queryClient) AnalyzeCode(ctx context.Context, in *QueryAnalyzeCodeRequest, opts ...grpc.CallOption) (*QueryAnalyzeCodeResponse, error) { + out := new(QueryAnalyzeCodeResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/AnalyzeCode", in, out, opts...) + if err != nil { + return nil, err } - return len(dAtA) - i, nil + return out, nil } -func (m *QueryContractAddressResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) +func (c *queryClient) BlockCreateResults(ctx context.Context, in *QueryBlockCreateResultsRequest, opts ...grpc.CallOption) (*QueryBlockCreateResultsResponse, error) { + out := new(QueryBlockCreateResultsResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/BlockCreateResults", in, out, opts...) if err != nil { return nil, err } - return dAtA[:n], nil + return out, nil } -func (m *QueryContractAddressResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryContractAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil +// QueryServer is the server API for Query service. +type QueryServer interface { + // Query contract info by address + ContractInfo(context.Context, *QueryByContractAddressRequest) (*QueryContractInfoResponse, error) + // Query code info by id + ContractsByCodeId(context.Context, *QueryByCodeIdRequest) (*QueryContractsByCodeIdResponse, error) + // Query secret contract + QuerySecretContract(context.Context, *QuerySecretContractRequest) (*QuerySecretContractResponse, error) + // Query a specific contract code by id + Code(context.Context, *QueryByCodeIdRequest) (*QueryCodeResponse, error) + // Query all contract codes on-chain + Codes(context.Context, *emptypb.Empty) (*QueryCodesResponse, error) + // Query code hash by contract address + CodeHashByContractAddress(context.Context, *QueryByContractAddressRequest) (*QueryCodeHashResponse, error) + // Query code hash by code id + CodeHashByCodeId(context.Context, *QueryByCodeIdRequest) (*QueryCodeHashResponse, error) + // Query contract label by address + LabelByAddress(context.Context, *QueryByContractAddressRequest) (*QueryContractLabelResponse, error) + // Query contract address by label + AddressByLabel(context.Context, *QueryByLabelRequest) (*QueryContractAddressResponse, error) + // ContractHistory gets the contract code history + ContractHistory(context.Context, *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) + // Params defines a gRPC query method that returns the compute + // module's parameters. + Params(context.Context, *ParamsRequest) (*ParamsResponse, error) + // Query authorized migration for a contract + AuthorizedMigration(context.Context, *QueryAuthorizedMigrationRequest) (*QueryAuthorizedMigrationResponse, error) + // Query authorized admin update for a contract + AuthorizedAdminUpdate(context.Context, *QueryAuthorizedAdminUpdateRequest) (*QueryAuthorizedAdminUpdateResponse, error) + // Query ecall record for a specific block height (for non-SGX node sync) + EcallRecord(context.Context, *QueryEcallRecordRequest) (*QueryEcallRecordResponse, error) + // Query ecall records for a range of block heights (batch sync) + EcallRecords(context.Context, *QueryEcallRecordsRequest) (*QueryEcallRecordsResponse, error) + // Query encrypted seed by certificate hash (for non-SGX node sync) + EncryptedSeed(context.Context, *QueryEncryptedSeedRequest) (*QueryEncryptedSeedResponse, error) + // Query all execution traces for a block (batch fetch for non-SGX node sync) + BlockTraces(context.Context, *QueryBlockTracesRequest) (*QueryBlockTracesResponse, error) + // Query machine ID proof for a specific block height and machine ID (for non-SGX node sync) + MachineIDProof(context.Context, *QueryMachineIDProofRequest) (*QueryMachineIDProofResponse, error) + // Analyze code to determine IBC entry points and required features + AnalyzeCode(context.Context, *QueryAnalyzeCodeRequest) (*QueryAnalyzeCodeResponse, error) + // Query all Create (MsgStoreCode) results for a block (for non-SGX node sync) + BlockCreateResults(context.Context, *QueryBlockCreateResultsRequest) (*QueryBlockCreateResultsResponse, error) } -func (m *QueryContractLabelResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { } -func (m *QueryContractLabelResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (*UnimplementedQueryServer) ContractInfo(ctx context.Context, req *QueryByContractAddressRequest) (*QueryContractInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ContractInfo not implemented") } - -func (m *QueryContractLabelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Label) > 0 { - i -= len(m.Label) - copy(dAtA[i:], m.Label) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Label))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil +func (*UnimplementedQueryServer) ContractsByCodeId(ctx context.Context, req *QueryByCodeIdRequest) (*QueryContractsByCodeIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ContractsByCodeId not implemented") } - -func (m *QueryCodeHashResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil +func (*UnimplementedQueryServer) QuerySecretContract(ctx context.Context, req *QuerySecretContractRequest) (*QuerySecretContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QuerySecretContract not implemented") +} +func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryByCodeIdRequest) (*QueryCodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Code not implemented") +} +func (*UnimplementedQueryServer) Codes(ctx context.Context, req *emptypb.Empty) (*QueryCodesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Codes not implemented") +} +func (*UnimplementedQueryServer) CodeHashByContractAddress(ctx context.Context, req *QueryByContractAddressRequest) (*QueryCodeHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CodeHashByContractAddress not implemented") +} +func (*UnimplementedQueryServer) CodeHashByCodeId(ctx context.Context, req *QueryByCodeIdRequest) (*QueryCodeHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CodeHashByCodeId not implemented") +} +func (*UnimplementedQueryServer) LabelByAddress(ctx context.Context, req *QueryByContractAddressRequest) (*QueryContractLabelResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LabelByAddress not implemented") +} +func (*UnimplementedQueryServer) AddressByLabel(ctx context.Context, req *QueryByLabelRequest) (*QueryContractAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddressByLabel not implemented") +} +func (*UnimplementedQueryServer) ContractHistory(ctx context.Context, req *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ContractHistory not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) AuthorizedMigration(ctx context.Context, req *QueryAuthorizedMigrationRequest) (*QueryAuthorizedMigrationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuthorizedMigration not implemented") +} +func (*UnimplementedQueryServer) AuthorizedAdminUpdate(ctx context.Context, req *QueryAuthorizedAdminUpdateRequest) (*QueryAuthorizedAdminUpdateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuthorizedAdminUpdate not implemented") +} +func (*UnimplementedQueryServer) EcallRecord(ctx context.Context, req *QueryEcallRecordRequest) (*QueryEcallRecordResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EcallRecord not implemented") +} +func (*UnimplementedQueryServer) EcallRecords(ctx context.Context, req *QueryEcallRecordsRequest) (*QueryEcallRecordsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EcallRecords not implemented") +} +func (*UnimplementedQueryServer) EncryptedSeed(ctx context.Context, req *QueryEncryptedSeedRequest) (*QueryEncryptedSeedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EncryptedSeed not implemented") +} +func (*UnimplementedQueryServer) BlockTraces(ctx context.Context, req *QueryBlockTracesRequest) (*QueryBlockTracesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BlockTraces not implemented") +} +func (*UnimplementedQueryServer) MachineIDProof(ctx context.Context, req *QueryMachineIDProofRequest) (*QueryMachineIDProofResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MachineIDProof not implemented") +} +func (*UnimplementedQueryServer) AnalyzeCode(ctx context.Context, req *QueryAnalyzeCodeRequest) (*QueryAnalyzeCodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AnalyzeCode not implemented") +} +func (*UnimplementedQueryServer) BlockCreateResults(ctx context.Context, req *QueryBlockCreateResultsRequest) (*QueryBlockCreateResultsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BlockCreateResults not implemented") } -func (m *QueryCodeHashResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) } -func (m *QueryCodeHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CodeHash) > 0 { - i -= len(m.CodeHash) - copy(dAtA[i:], m.CodeHash) - i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) - i-- - dAtA[i] = 0xa +func _Query_ContractInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByContractAddressRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).ContractInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/ContractInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ContractInfo(ctx, req.(*QueryByContractAddressRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *DecryptedAnswer) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_ContractsByCodeId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByCodeIdRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).ContractsByCodeId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/ContractsByCodeId", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ContractsByCodeId(ctx, req.(*QueryByCodeIdRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *DecryptedAnswer) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_QuerySecretContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySecretContractRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QuerySecretContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/QuerySecretContract", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QuerySecretContract(ctx, req.(*QuerySecretContractRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *DecryptedAnswer) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.OutputDataAsString) > 0 { - i -= len(m.OutputDataAsString) - copy(dAtA[i:], m.OutputDataAsString) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputDataAsString))) - i-- - dAtA[i] = 0x22 +func _Query_Code_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByCodeIdRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.OutputData) > 0 { - i -= len(m.OutputData) - copy(dAtA[i:], m.OutputData) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputData))) - i-- - dAtA[i] = 0x1a + if interceptor == nil { + return srv.(QueryServer).Code(ctx, in) } - if len(m.Input) > 0 { - i -= len(m.Input) - copy(dAtA[i:], m.Input) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Input))) - i-- - dAtA[i] = 0x12 + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/Code", } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Code(ctx, req.(*QueryByCodeIdRequest)) } - return len(dAtA) - i, nil + return interceptor(ctx, in, info, handler) } -func (m *DecryptedAnswers) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Codes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Codes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/Codes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Codes(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) } -func (m *DecryptedAnswers) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DecryptedAnswers) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PlaintextError) > 0 { - i -= len(m.PlaintextError) - copy(dAtA[i:], m.PlaintextError) - i = encodeVarintQuery(dAtA, i, uint64(len(m.PlaintextError))) - i-- - dAtA[i] = 0x22 +func _Query_CodeHashByContractAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByContractAddressRequest) + if err := dec(in); err != nil { + return nil, err } - if len(m.OutputError) > 0 { - i -= len(m.OutputError) - copy(dAtA[i:], m.OutputError) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputError))) - i-- - dAtA[i] = 0x1a + if interceptor == nil { + return srv.(QueryServer).CodeHashByContractAddress(ctx, in) } - if len(m.OutputLogs) > 0 { - for iNdEx := len(m.OutputLogs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.OutputLogs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/CodeHashByContractAddress", } - if len(m.Answers) > 0 { - for iNdEx := len(m.Answers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Answers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CodeHashByContractAddress(ctx, req.(*QueryByContractAddressRequest)) } - return len(dAtA) - i, nil + return interceptor(ctx, in, info, handler) } -func (m *QueryContractHistoryRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_CodeHashByCodeId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByCodeIdRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil -} - -func (m *QueryContractHistoryRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryContractHistoryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa + if interceptor == nil { + return srv.(QueryServer).CodeHashByCodeId(ctx, in) } - return len(dAtA) - i, nil + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/CodeHashByCodeId", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CodeHashByCodeId(ctx, req.(*QueryByCodeIdRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryContractHistoryResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_LabelByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByContractAddressRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).LabelByAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/LabelByAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LabelByAddress(ctx, req.(*QueryByContractAddressRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryContractHistoryResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_AddressByLabel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryByLabelRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AddressByLabel(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/AddressByLabel", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AddressByLabel(ctx, req.(*QueryByLabelRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryContractHistoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Entries) > 0 { - for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } +func _Query_ContractHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryContractHistoryRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).ContractHistory(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/ContractHistory", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ContractHistory(ctx, req.(*QueryContractHistoryRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAuthorizedMigrationRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ParamsRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAuthorizedMigrationRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func _Query_AuthorizedMigration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAuthorizedMigrationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AuthorizedMigration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/AuthorizedMigration", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AuthorizedMigration(ctx, req.(*QueryAuthorizedMigrationRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAuthorizedMigrationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ContractAddress) > 0 { - i -= len(m.ContractAddress) - copy(dAtA[i:], m.ContractAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) - i-- - dAtA[i] = 0xa +func _Query_AuthorizedAdminUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAuthorizedAdminUpdateRequest) + if err := dec(in); err != nil { + return nil, err } - return len(dAtA) - i, nil + if interceptor == nil { + return srv.(QueryServer).AuthorizedAdminUpdate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/AuthorizedAdminUpdate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AuthorizedAdminUpdate(ctx, req.(*QueryAuthorizedAdminUpdateRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAuthorizedMigrationResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { +func _Query_EcallRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEcallRecordRequest) + if err := dec(in); err != nil { return nil, err } - return dAtA[:n], nil + if interceptor == nil { + return srv.(QueryServer).EcallRecord(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/EcallRecord", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EcallRecord(ctx, req.(*QueryEcallRecordRequest)) + } + return interceptor(ctx, in, info, handler) } -func (m *QueryAuthorizedMigrationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} +func _Query_EcallRecords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEcallRecordsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EcallRecords(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/EcallRecords", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EcallRecords(ctx, req.(*QueryEcallRecordsRequest)) + } + return interceptor(ctx, in, info, handler) +} -func (m *QueryAuthorizedMigrationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func _Query_EncryptedSeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEncryptedSeedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EncryptedSeed(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/EncryptedSeed", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EncryptedSeed(ctx, req.(*QueryEncryptedSeedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_BlockTraces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBlockTracesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BlockTraces(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/BlockTraces", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BlockTraces(ctx, req.(*QueryBlockTracesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_MachineIDProof_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryMachineIDProofRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).MachineIDProof(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/MachineIDProof", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).MachineIDProof(ctx, req.(*QueryMachineIDProofRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AnalyzeCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAnalyzeCodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AnalyzeCode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/AnalyzeCode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AnalyzeCode(ctx, req.(*QueryAnalyzeCodeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_BlockCreateResults_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBlockCreateResultsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BlockCreateResults(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/BlockCreateResults", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BlockCreateResults(ctx, req.(*QueryBlockCreateResultsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "secret.compute.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ContractInfo", + Handler: _Query_ContractInfo_Handler, + }, + { + MethodName: "ContractsByCodeId", + Handler: _Query_ContractsByCodeId_Handler, + }, + { + MethodName: "QuerySecretContract", + Handler: _Query_QuerySecretContract_Handler, + }, + { + MethodName: "Code", + Handler: _Query_Code_Handler, + }, + { + MethodName: "Codes", + Handler: _Query_Codes_Handler, + }, + { + MethodName: "CodeHashByContractAddress", + Handler: _Query_CodeHashByContractAddress_Handler, + }, + { + MethodName: "CodeHashByCodeId", + Handler: _Query_CodeHashByCodeId_Handler, + }, + { + MethodName: "LabelByAddress", + Handler: _Query_LabelByAddress_Handler, + }, + { + MethodName: "AddressByLabel", + Handler: _Query_AddressByLabel_Handler, + }, + { + MethodName: "ContractHistory", + Handler: _Query_ContractHistory_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "AuthorizedMigration", + Handler: _Query_AuthorizedMigration_Handler, + }, + { + MethodName: "AuthorizedAdminUpdate", + Handler: _Query_AuthorizedAdminUpdate_Handler, + }, + { + MethodName: "EcallRecord", + Handler: _Query_EcallRecord_Handler, + }, + { + MethodName: "EcallRecords", + Handler: _Query_EcallRecords_Handler, + }, + { + MethodName: "EncryptedSeed", + Handler: _Query_EncryptedSeed_Handler, + }, + { + MethodName: "BlockTraces", + Handler: _Query_BlockTraces_Handler, + }, + { + MethodName: "MachineIDProof", + Handler: _Query_MachineIDProof_Handler, + }, + { + MethodName: "AnalyzeCode", + Handler: _Query_AnalyzeCode_Handler, + }, + { + MethodName: "BlockCreateResults", + Handler: _Query_BlockCreateResults_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "secret/compute/v1beta1/query.proto", +} + +func (m *ParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.NewCodeID != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.NewCodeID)) - i-- - dAtA[i] = 0x8 + return len(dAtA) - i, nil +} + +func (m *ParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *QueryAuthorizedAdminUpdateRequest) Marshal() (dAtA []byte, err error) { +func (m *QuerySecretContractRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2921,16 +3782,23 @@ func (m *QueryAuthorizedAdminUpdateRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAuthorizedAdminUpdateRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QuerySecretContractRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAuthorizedAdminUpdateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QuerySecretContractRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.Query) > 0 { + i -= len(m.Query) + copy(dAtA[i:], m.Query) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Query))) + i-- + dAtA[i] = 0x12 + } if len(m.ContractAddress) > 0 { i -= len(m.ContractAddress) copy(dAtA[i:], m.ContractAddress) @@ -2941,7 +3809,7 @@ func (m *QueryAuthorizedAdminUpdateRequest) MarshalToSizedBuffer(dAtA []byte) (i return len(dAtA) - i, nil } -func (m *QueryAuthorizedAdminUpdateResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryByLabelRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2951,413 +3819,3708 @@ func (m *QueryAuthorizedAdminUpdateResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *QueryAuthorizedAdminUpdateResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryByLabelRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAuthorizedAdminUpdateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryByLabelRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.NewAdmin) > 0 { - i -= len(m.NewAdmin) - copy(dAtA[i:], m.NewAdmin) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NewAdmin))) + if len(m.Label) > 0 { + i -= len(m.Label) + copy(dAtA[i:], m.Label) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Label))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ParamsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryByContractAddressRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *ParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n +func (m *QueryByContractAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QuerySecretContractRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryByContractAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Query) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryByLabelRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Label) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryByCodeIdRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryByContractAddressRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n +func (m *QueryByCodeIdRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryByCodeIdRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryByCodeIdRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if m.CodeId != 0 { - n += 1 + sovQuery(uint64(m.CodeId)) + i = encodeVarintQuery(dAtA, i, uint64(m.CodeId)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QuerySecretContractResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QuerySecretContractResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QuerySecretContractResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySecretContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Data) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryContractInfoResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryContractInfoResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryContractInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } if m.ContractInfo != nil { - l = m.ContractInfo.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.ContractInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return n + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *ContractInfoWithAddress) Size() (n int) { - if m == nil { - return 0 +func (m *ContractInfoWithAddress) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *ContractInfoWithAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ContractInfoWithAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } if m.ContractInfo != nil { - l = m.ContractInfo.Size() - n += 1 + l + sovQuery(uint64(l)) + { + size, err := m.ContractInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return n + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *QueryContractsByCodeIdResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryContractsByCodeIdResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryContractsByCodeIdResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractsByCodeIdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if len(m.ContractInfos) > 0 { - for _, e := range m.ContractInfos { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + for iNdEx := len(m.ContractInfos) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ContractInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } } - return n + return len(dAtA) - i, nil } -func (m *CodeInfoResponse) Size() (n int) { - if m == nil { - return 0 +func (m *CodeInfoResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *CodeInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CodeInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.CodeId != 0 { - n += 1 + sovQuery(uint64(m.CodeId)) + if len(m.Builder) > 0 { + i -= len(m.Builder) + copy(dAtA[i:], m.Builder) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Builder))) + i-- + dAtA[i] = 0x2a } - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Source) > 0 { + i -= len(m.Source) + copy(dAtA[i:], m.Source) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Source))) + i-- + dAtA[i] = 0x22 } - l = len(m.CodeHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0x1a } - l = len(m.Source) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x12 } - l = len(m.Builder) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.CodeId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.CodeId)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryCodeResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryCodeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryCodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.CodeInfoResponse != nil { - l = m.CodeInfoResponse.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.Wasm) > 0 { + i -= len(m.Wasm) + copy(dAtA[i:], m.Wasm) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Wasm))) + i-- + dAtA[i] = 0x12 } - l = len(m.Wasm) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.CodeInfoResponse != nil { + { + size, err := m.CodeInfoResponse.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryCodesResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryCodesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryCodesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if len(m.CodeInfos) > 0 { - for _, e := range m.CodeInfos { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + for iNdEx := len(m.CodeInfos) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CodeInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } } - return n + return len(dAtA) - i, nil } -func (m *QueryContractAddressResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryContractAddressResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryContractAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryContractLabelResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryContractLabelResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryContractLabelResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractLabelResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Label) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Label) > 0 { + i -= len(m.Label) + copy(dAtA[i:], m.Label) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Label))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryCodeHashResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryCodeHashResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryCodeHashResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCodeHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.CodeHash) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *DecryptedAnswer) Size() (n int) { - if m == nil { - return 0 +func (m *DecryptedAnswer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *DecryptedAnswer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DecryptedAnswer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.OutputDataAsString) > 0 { + i -= len(m.OutputDataAsString) + copy(dAtA[i:], m.OutputDataAsString) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputDataAsString))) + i-- + dAtA[i] = 0x22 } - l = len(m.Input) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.OutputData) > 0 { + i -= len(m.OutputData) + copy(dAtA[i:], m.OutputData) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputData))) + i-- + dAtA[i] = 0x1a } - l = len(m.OutputData) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Input) > 0 { + i -= len(m.Input) + copy(dAtA[i:], m.Input) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Input))) + i-- + dAtA[i] = 0x12 } - l = len(m.OutputDataAsString) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *DecryptedAnswers) Size() (n int) { - if m == nil { - return 0 +func (m *DecryptedAnswers) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *DecryptedAnswers) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DecryptedAnswers) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.Answers) > 0 { - for _, e := range m.Answers { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } + if len(m.PlaintextError) > 0 { + i -= len(m.PlaintextError) + copy(dAtA[i:], m.PlaintextError) + i = encodeVarintQuery(dAtA, i, uint64(len(m.PlaintextError))) + i-- + dAtA[i] = 0x22 + } + if len(m.OutputError) > 0 { + i -= len(m.OutputError) + copy(dAtA[i:], m.OutputError) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OutputError))) + i-- + dAtA[i] = 0x1a } if len(m.OutputLogs) > 0 { - for _, e := range m.OutputLogs { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + for iNdEx := len(m.OutputLogs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OutputLogs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } } - l = len(m.OutputError) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.PlaintextError) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.Answers) > 0 { + for iNdEx := len(m.Answers) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Answers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return n + return len(dAtA) - i, nil } -func (m *QueryContractHistoryRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryContractHistoryRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryContractHistoryRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractHistoryRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryContractHistoryResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryContractHistoryResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryContractHistoryResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryContractHistoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } } - return n + return len(dAtA) - i, nil } -func (m *QueryAuthorizedMigrationRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryAuthorizedMigrationRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryAuthorizedMigrationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorizedMigrationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *QueryAuthorizedMigrationResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryAuthorizedMigrationResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *QueryAuthorizedMigrationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorizedMigrationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l if m.NewCodeID != 0 { - n += 1 + sovQuery(uint64(m.NewCodeID)) + i = encodeVarintQuery(dAtA, i, uint64(m.NewCodeID)) + i-- + dAtA[i] = 0x8 } - return n + return len(dAtA) - i, nil } -func (m *QueryAuthorizedAdminUpdateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ContractAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) +func (m *QueryAuthorizedAdminUpdateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return n + return dAtA[:n], nil } -func (m *QueryAuthorizedAdminUpdateResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryAuthorizedAdminUpdateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorizedAdminUpdateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.NewAdmin) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil +} + +func (m *QueryAuthorizedAdminUpdateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAuthorizedAdminUpdateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAuthorizedAdminUpdateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NewAdmin) > 0 { + i -= len(m.NewAdmin) + copy(dAtA[i:], m.NewAdmin) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NewAdmin))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryEcallRecordRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEcallRecordRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEcallRecordRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryEcallRecordResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEcallRecordResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEcallRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorSetEvidence) > 0 { + i -= len(m.ValidatorSetEvidence) + copy(dAtA[i:], m.ValidatorSetEvidence) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorSetEvidence))) + i-- + dAtA[i] = 0x1a + } + if len(m.RandomSeed) > 0 { + i -= len(m.RandomSeed) + copy(dAtA[i:], m.RandomSeed) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RandomSeed))) + i-- + dAtA[i] = 0x12 + } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryEcallRecordsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEcallRecordsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEcallRecordsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EndHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.EndHeight)) + i-- + dAtA[i] = 0x10 + } + if m.StartHeight != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.StartHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryEcallRecordsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEcallRecordsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEcallRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Records) > 0 { + for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryEncryptedSeedRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEncryptedSeedRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEncryptedSeedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + if len(m.CertHash) > 0 { + i -= len(m.CertHash) + copy(dAtA[i:], m.CertHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CertHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryEncryptedSeedResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryEncryptedSeedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEncryptedSeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EncryptedSeed) > 0 { + i -= len(m.EncryptedSeed) + copy(dAtA[i:], m.EncryptedSeed) + i = encodeVarintQuery(dAtA, i, uint64(len(m.EncryptedSeed))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *StorageOp) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StorageOp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StorageOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x1a + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 + } + if m.IsDelete { + i-- + if m.IsDelete { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *CrossModuleOp) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CrossModuleOp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CrossModuleOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsDelete { + i-- + if m.IsDelete { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x1a + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 + } + if len(m.StoreKey) > 0 { + i -= len(m.StoreKey) + copy(dAtA[i:], m.StoreKey) + i = encodeVarintQuery(dAtA, i, uint64(len(m.StoreKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ExecutionTraceData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ExecutionTraceData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExecutionTraceData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CrossOps) > 0 { + for iNdEx := len(m.CrossOps) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CrossOps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if m.CallbackGas != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.CallbackGas)) + i-- + dAtA[i] = 0x38 + } + if len(m.ErrorMsg) > 0 { + i -= len(m.ErrorMsg) + copy(dAtA[i:], m.ErrorMsg) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ErrorMsg))) + i-- + dAtA[i] = 0x32 + } + if m.HasError { + i-- + if m.HasError { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.GasUsed != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x20 + } + if len(m.Result) > 0 { + i -= len(m.Result) + copy(dAtA[i:], m.Result) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Result))) + i-- + dAtA[i] = 0x1a + } + if len(m.Ops) > 0 { + for iNdEx := len(m.Ops) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Ops[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Index != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryBlockTracesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryBlockTracesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlockTracesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryBlockTracesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryBlockTracesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlockTracesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Traces) > 0 { + for iNdEx := len(m.Traces) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Traces[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryMachineIDProofRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryMachineIDProofRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMachineIDProofRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MachineId) > 0 { + i -= len(m.MachineId) + copy(dAtA[i:], m.MachineId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.MachineId))) + i-- + dAtA[i] = 0x12 + } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryMachineIDProofResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryMachineIDProofResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMachineIDProofResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Proof) > 0 { + i -= len(m.Proof) + copy(dAtA[i:], m.Proof) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Proof))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAnalyzeCodeRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAnalyzeCodeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAnalyzeCodeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAnalyzeCodeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryAnalyzeCodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAnalyzeCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RequiredFeatures) > 0 { + i -= len(m.RequiredFeatures) + copy(dAtA[i:], m.RequiredFeatures) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RequiredFeatures))) + i-- + dAtA[i] = 0x12 + } + if m.HasIbcEntryPoints { + i-- + if m.HasIbcEntryPoints { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *CreateResultData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateResultData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CreateResultData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ErrorMsg) > 0 { + i -= len(m.ErrorMsg) + copy(dAtA[i:], m.ErrorMsg) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ErrorMsg))) + i-- + dAtA[i] = 0x22 + } + if m.HasError { + i-- + if m.HasError { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0x12 + } + if len(m.WasmHash) > 0 { + i -= len(m.WasmHash) + copy(dAtA[i:], m.WasmHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.WasmHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBlockCreateResultsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryBlockCreateResultsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlockCreateResultsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryBlockCreateResultsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryBlockCreateResultsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBlockCreateResultsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Results) > 0 { + for iNdEx := len(m.Results) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Results[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QuerySecretContractRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Query) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryByLabelRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Label) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryByContractAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryByCodeIdRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CodeId != 0 { + n += 1 + sovQuery(uint64(m.CodeId)) + } + return n +} + +func (m *QuerySecretContractResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.ContractInfo != nil { + l = m.ContractInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *ContractInfoWithAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.ContractInfo != nil { + l = m.ContractInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractsByCodeIdResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ContractInfos) > 0 { + for _, e := range m.ContractInfos { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *CodeInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CodeId != 0 { + n += 1 + sovQuery(uint64(m.CodeId)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Source) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Builder) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CodeInfoResponse != nil { + l = m.CodeInfoResponse.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Wasm) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCodesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.CodeInfos) > 0 { + for _, e := range m.CodeInfos { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryContractAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractLabelResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Label) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCodeHashResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *DecryptedAnswer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Input) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.OutputData) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.OutputDataAsString) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *DecryptedAnswers) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Answers) > 0 { + for _, e := range m.Answers { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if len(m.OutputLogs) > 0 { + for _, e := range m.OutputLogs { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + l = len(m.OutputError) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.PlaintextError) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractHistoryRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryContractHistoryResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryAuthorizedMigrationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAuthorizedMigrationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NewCodeID != 0 { + n += 1 + sovQuery(uint64(m.NewCodeID)) + } + return n +} + +func (m *QueryAuthorizedAdminUpdateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAuthorizedAdminUpdateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NewAdmin) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryEcallRecordRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryEcallRecordResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + l = len(m.RandomSeed) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ValidatorSetEvidence) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryEcallRecordsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StartHeight != 0 { + n += 1 + sovQuery(uint64(m.StartHeight)) + } + if m.EndHeight != 0 { + n += 1 + sovQuery(uint64(m.EndHeight)) + } + return n +} + +func (m *QueryEcallRecordsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Records) > 0 { + for _, e := range m.Records { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryEncryptedSeedRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CertHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryEncryptedSeedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.EncryptedSeed) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *StorageOp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IsDelete { + n += 2 + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *CrossModuleOp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.StoreKey) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.IsDelete { + n += 2 + } + return n +} + +func (m *ExecutionTraceData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Index != 0 { + n += 1 + sovQuery(uint64(m.Index)) + } + if len(m.Ops) > 0 { + for _, e := range m.Ops { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + l = len(m.Result) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.GasUsed != 0 { + n += 1 + sovQuery(uint64(m.GasUsed)) + } + if m.HasError { + n += 2 + } + l = len(m.ErrorMsg) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.CallbackGas != 0 { + n += 1 + sovQuery(uint64(m.CallbackGas)) + } + if len(m.CrossOps) > 0 { + for _, e := range m.CrossOps { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryBlockTracesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryBlockTracesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Traces) > 0 { + for _, e := range m.Traces { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryMachineIDProofRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + l = len(m.MachineId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryMachineIDProofResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Proof) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAnalyzeCodeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAnalyzeCodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HasIbcEntryPoints { + n += 2 + } + l = len(m.RequiredFeatures) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *CreateResultData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WasmHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.HasError { + n += 2 + } + l = len(m.ErrorMsg) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBlockCreateResultsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryBlockCreateResultsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Results) > 0 { + for _, e := range m.Results { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySecretContractRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySecretContractRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySecretContractRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Query = append(m.Query[:0], dAtA[iNdEx:postIndex]...) + if m.Query == nil { + m.Query = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryByLabelRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryByLabelRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryByLabelRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Label = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryByContractAddressRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryByContractAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryByContractAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryByCodeIdRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryByCodeIdRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryByCodeIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + } + m.CodeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySecretContractResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySecretContractResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySecretContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryContractInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContractInfo == nil { + m.ContractInfo = &ContractInfo{} + } + if err := m.ContractInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContractInfoWithAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContractInfoWithAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ContractInfo == nil { + m.ContractInfo = &ContractInfo{} + } + if err := m.ContractInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryContractsByCodeIdResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryContractsByCodeIdResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractsByCodeIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractInfos", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractInfos = append(m.ContractInfos, ContractInfoWithAddress{}) + if err := m.ContractInfos[len(m.ContractInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CodeInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CodeInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + } + m.CodeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Source = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Builder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Builder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeInfoResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CodeInfoResponse == nil { + m.CodeInfoResponse = &CodeInfoResponse{} + } + if err := m.CodeInfoResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Wasm", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Wasm = append(m.Wasm[:0], dAtA[iNdEx:postIndex]...) + if m.Wasm == nil { + m.Wasm = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCodesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeInfos", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeInfos = append(m.CodeInfos, CodeInfoResponse{}) + if err := m.CodeInfos[len(m.CodeInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryContractAddressResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryContractAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } +func (m *QueryContractLabelResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryContractLabelResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryContractLabelResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Label = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func (m *QueryCodeHashResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCodeHashResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCodeHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *ParamsRequest) Unmarshal(dAtA []byte) error { +func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3367,25 +7530,153 @@ func (m *ParamsRequest) Unmarshal(dAtA []byte) error { if shift >= 64 { return ErrIntOverflowQuery } - if iNdEx >= l { + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DecryptedAnswer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DecryptedAnswer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.Input = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutputData", wireType) } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OutputData = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutputDataAsString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OutputDataAsString = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3407,7 +7698,7 @@ func (m *ParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *ParamsResponse) Unmarshal(dAtA []byte) error { +func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3430,15 +7721,15 @@ func (m *ParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: DecryptedAnswers: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DecryptedAnswers: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Answers", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3465,63 +7756,48 @@ func (m *ParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Answers = append(m.Answers, &DecryptedAnswer{}) + if err := m.Answers[len(m.Answers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutputLogs", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + if msglen < 0 { + return ErrInvalidLengthQuery } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QuerySecretContractRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery } - if iNdEx >= l { + if postIndex > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break + m.OutputLogs = append(m.OutputLogs, types.StringEvent{}) + if err := m.OutputLogs[len(m.OutputLogs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QuerySecretContractRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySecretContractRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OutputError", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3549,13 +7825,13 @@ func (m *QuerySecretContractRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) + m.OutputError = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PlaintextError", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3565,25 +7841,23 @@ func (m *QuerySecretContractRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Query = append(m.Query[:0], dAtA[iNdEx:postIndex]...) - if m.Query == nil { - m.Query = []byte{} - } + m.PlaintextError = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3606,7 +7880,7 @@ func (m *QuerySecretContractRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryByLabelRequest) Unmarshal(dAtA []byte) error { +func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3629,15 +7903,15 @@ func (m *QueryByLabelRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryByLabelRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryContractHistoryRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryByLabelRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryContractHistoryRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3665,7 +7939,7 @@ func (m *QueryByLabelRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Label = string(dAtA[iNdEx:postIndex]) + m.ContractAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3688,7 +7962,7 @@ func (m *QueryByLabelRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryByContractAddressRequest) Unmarshal(dAtA []byte) error { +func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3711,17 +7985,17 @@ func (m *QueryByContractAddressRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryByContractAddressRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryContractHistoryResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryByContractAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryContractHistoryResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3731,23 +8005,25 @@ func (m *QueryByContractAddressRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) + m.Entries = append(m.Entries, ContractCodeHistoryEntry{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3770,7 +8046,7 @@ func (m *QueryByContractAddressRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryByCodeIdRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAuthorizedMigrationRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3793,17 +8069,17 @@ func (m *QueryByCodeIdRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryByCodeIdRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAuthorizedMigrationRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryByCodeIdRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAuthorizedMigrationRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) } - m.CodeId = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3813,11 +8089,24 @@ func (m *QueryByCodeIdRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CodeId |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3839,7 +8128,7 @@ func (m *QueryByCodeIdRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QuerySecretContractResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAuthorizedMigrationResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3862,17 +8151,17 @@ func (m *QuerySecretContractResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QuerySecretContractResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAuthorizedMigrationResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySecretContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAuthorizedMigrationResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NewCodeID", wireType) } - var byteLen int + m.NewCodeID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3882,26 +8171,11 @@ func (m *QuerySecretContractResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.NewCodeID |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3923,7 +8197,7 @@ func (m *QuerySecretContractResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAuthorizedAdminUpdateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3946,10 +8220,10 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractInfoResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAuthorizedAdminUpdateRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAuthorizedAdminUpdateRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3984,42 +8258,6 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { } m.ContractAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContractInfo == nil { - m.ContractInfo = &ContractInfo{} - } - if err := m.ContractInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4041,7 +8279,7 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error { +func (m *QueryAuthorizedAdminUpdateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4064,15 +8302,15 @@ func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ContractInfoWithAddress: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAuthorizedAdminUpdateResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ContractInfoWithAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAuthorizedAdminUpdateResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4100,43 +8338,7 @@ func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContractInfo == nil { - m.ContractInfo = &ContractInfo{} - } - if err := m.ContractInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.NewAdmin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4159,7 +8361,7 @@ func (m *ContractInfoWithAddress) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractsByCodeIdResponse) Unmarshal(dAtA []byte) error { +func (m *QueryEcallRecordRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4182,17 +8384,17 @@ func (m *QueryContractsByCodeIdResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractsByCodeIdResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEcallRecordRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractsByCodeIdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEcallRecordRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractInfos", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var msglen int + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4202,26 +8404,11 @@ func (m *QueryContractsByCodeIdResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContractInfos = append(m.ContractInfos, ContractInfoWithAddress{}) - if err := m.ContractInfos[len(m.ContractInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4243,7 +8430,7 @@ func (m *QueryContractsByCodeIdResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { +func (m *QueryEcallRecordResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4266,17 +8453,17 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CodeInfoResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEcallRecordResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CodeInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEcallRecordResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - m.CodeId = 0 + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4286,16 +8473,16 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CodeId |= uint64(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RandomSeed", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4305,29 +8492,31 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Creator = string(dAtA[iNdEx:postIndex]) + m.RandomSeed = append(m.RandomSeed[:0], dAtA[iNdEx:postIndex]...) + if m.RandomSeed == nil { + m.RandomSeed = []byte{} + } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetEvidence", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4337,29 +8526,81 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.CodeHash = string(dAtA[iNdEx:postIndex]) + m.ValidatorSetEvidence = append(m.ValidatorSetEvidence[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorSetEvidence == nil { + m.ValidatorSetEvidence = []byte{} + } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - var stringLen uint64 + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEcallRecordsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEcallRecordsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEcallRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) + } + m.StartHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4369,29 +8610,85 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.StartHeight |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EndHeight", wireType) } - postIndex := iNdEx + intStringLen - if postIndex < 0 { + m.EndHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EndHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEcallRecordsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Source = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryEcallRecordsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEcallRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Builder", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4401,23 +8698,25 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Builder = string(dAtA[iNdEx:postIndex]) + m.Records = append(m.Records, QueryEcallRecordResponse{}) + if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -4440,7 +8739,7 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { +func (m *QueryEncryptedSeedRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4463,17 +8762,17 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCodeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEncryptedSeedRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEncryptedSeedRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeInfoResponse", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CertHash", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4483,33 +8782,29 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if m.CodeInfoResponse == nil { - m.CodeInfoResponse = &CodeInfoResponse{} - } - if err := m.CodeInfoResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.CertHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Wasm", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var byteLen int + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4519,26 +8814,11 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Wasm = append(m.Wasm[:0], dAtA[iNdEx:postIndex]...) - if m.Wasm == nil { - m.Wasm = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4560,7 +8840,7 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryEncryptedSeedResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4583,17 +8863,17 @@ func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCodesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEncryptedSeedResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCodesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEncryptedSeedResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeInfos", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field EncryptedSeed", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4603,24 +8883,24 @@ func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.CodeInfos = append(m.CodeInfos, CodeInfoResponse{}) - if err := m.CodeInfos[len(m.CodeInfos)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.EncryptedSeed = append(m.EncryptedSeed[:0], dAtA[iNdEx:postIndex]...) + if m.EncryptedSeed == nil { + m.EncryptedSeed = []byte{} } iNdEx = postIndex default: @@ -4644,7 +8924,7 @@ func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractAddressResponse) Unmarshal(dAtA []byte) error { +func (m *StorageOp) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4667,17 +8947,37 @@ func (m *QueryContractAddressResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractAddressResponse: wiretype end group for non-group") + return fmt.Errorf("proto: StorageOp: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: StorageOp: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsDelete", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsDelete = bool(v != 0) + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4687,23 +8987,59 @@ func (m *QueryContractAddressResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex @@ -4726,7 +9062,7 @@ func (m *QueryContractAddressResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractLabelResponse) Unmarshal(dAtA []byte) error { +func (m *CrossModuleOp) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4749,17 +9085,117 @@ func (m *QueryContractLabelResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractLabelResponse: wiretype end group for non-group") + return fmt.Errorf("proto: CrossModuleOp: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractLabelResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CrossModuleOp: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StoreKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StoreKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF } - var stringLen uint64 + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsDelete", wireType) + } + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4769,24 +9205,12 @@ func (m *QueryContractLabelResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Label = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex + m.IsDelete = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4808,7 +9232,7 @@ func (m *QueryContractLabelResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryCodeHashResponse) Unmarshal(dAtA []byte) error { +func (m *ExecutionTraceData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4831,17 +9255,36 @@ func (m *QueryCodeHashResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryCodeHashResponse: wiretype end group for non-group") + return fmt.Errorf("proto: ExecutionTraceData: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCodeHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ExecutionTraceData: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) + } + m.Index = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Index |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Ops", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4851,79 +9294,31 @@ func (m *QueryCodeHashResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.CodeHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { + m.Ops = append(m.Ops, StorageOp{}) + if err := m.Ops[len(m.Ops)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DecryptedAnswer: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DecryptedAnswer: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4933,29 +9328,31 @@ func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Type = string(dAtA[iNdEx:postIndex]) + m.Result = append(m.Result[:0], dAtA[iNdEx:postIndex]...) + if m.Result == nil { + m.Result = []byte{} + } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) } - var stringLen uint64 + m.GasUsed = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4965,27 +9362,34 @@ func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.GasUsed |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HasError", wireType) } - if postIndex > l { - return io.ErrUnexpectedEOF + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - m.Input = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: + m.HasError = bool(v != 0) + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputData", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ErrorMsg", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5013,13 +9417,32 @@ func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OutputData = string(dAtA[iNdEx:postIndex]) + m.ErrorMsg = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CallbackGas", wireType) + } + m.CallbackGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CallbackGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputDataAsString", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CrossOps", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5029,23 +9452,25 @@ func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.OutputDataAsString = string(dAtA[iNdEx:postIndex]) + m.CrossOps = append(m.CrossOps, CrossModuleOp{}) + if err := m.CrossOps[len(m.CrossOps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -5068,7 +9493,7 @@ func (m *DecryptedAnswer) Unmarshal(dAtA []byte) error { } return nil } -func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { +func (m *QueryBlockTracesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5091,17 +9516,17 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DecryptedAnswers: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlockTracesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DecryptedAnswers: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlockTracesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Answers", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var msglen int + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5111,29 +9536,64 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthQuery + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + msglen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.Answers = append(m.Answers, &DecryptedAnswer{}) - if err := m.Answers[len(m.Answers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBlockTracesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery } - iNdEx = postIndex - case 2: + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryBlockTracesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBlockTracesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputLogs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Traces", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5150,26 +9610,76 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { break } } - if msglen < 0 { + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Traces = append(m.Traces, ExecutionTraceData{}) + if err := m.Traces[len(m.Traces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryMachineIDProofRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.OutputLogs = append(m.OutputLogs, types.StringEvent{}) - if err := m.OutputLogs[len(m.OutputLogs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutputError", wireType) + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryMachineIDProofRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMachineIDProofRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var stringLen uint64 + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5179,27 +9689,14 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OutputError = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PlaintextError", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MachineId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5227,7 +9724,7 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PlaintextError = string(dAtA[iNdEx:postIndex]) + m.MachineId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5250,7 +9747,7 @@ func (m *DecryptedAnswers) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { +func (m *QueryMachineIDProofResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5273,17 +9770,17 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractHistoryRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryMachineIDProofResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractHistoryRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryMachineIDProofResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5293,23 +9790,25 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) + m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...) + if m.Proof == nil { + m.Proof = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex @@ -5332,7 +9831,7 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAnalyzeCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5355,17 +9854,17 @@ func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryContractHistoryResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAnalyzeCodeRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryContractHistoryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAnalyzeCodeRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5375,24 +9874,24 @@ func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Entries = append(m.Entries, ContractCodeHistoryEntry{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.CodeHash = append(m.CodeHash[:0], dAtA[iNdEx:postIndex]...) + if m.CodeHash == nil { + m.CodeHash = []byte{} } iNdEx = postIndex default: @@ -5416,7 +9915,7 @@ func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAuthorizedMigrationRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAnalyzeCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5439,15 +9938,35 @@ func (m *QueryAuthorizedMigrationRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAuthorizedMigrationRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAnalyzeCodeResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAuthorizedMigrationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAnalyzeCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HasIbcEntryPoints", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.HasIbcEntryPoints = bool(v != 0) + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RequiredFeatures", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -5475,7 +9994,7 @@ func (m *QueryAuthorizedMigrationRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) + m.RequiredFeatures = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -5498,7 +10017,7 @@ func (m *QueryAuthorizedMigrationRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAuthorizedMigrationResponse) Unmarshal(dAtA []byte) error { +func (m *CreateResultData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5521,17 +10040,85 @@ func (m *QueryAuthorizedMigrationResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAuthorizedMigrationResponse: wiretype end group for non-group") + return fmt.Errorf("proto: CreateResultData: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAuthorizedMigrationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CreateResultData: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WasmHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WasmHash = append(m.WasmHash[:0], dAtA[iNdEx:postIndex]...) + if m.WasmHash == nil { + m.WasmHash = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeHash = append(m.CodeHash[:0], dAtA[iNdEx:postIndex]...) + if m.CodeHash == nil { + m.CodeHash = []byte{} + } + iNdEx = postIndex + case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NewCodeID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field HasError", wireType) } - m.NewCodeID = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5541,11 +10128,44 @@ func (m *QueryAuthorizedMigrationResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.NewCodeID |= uint64(b&0x7F) << shift + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.HasError = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorMsg", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ErrorMsg = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5567,7 +10187,7 @@ func (m *QueryAuthorizedMigrationResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAuthorizedAdminUpdateRequest) Unmarshal(dAtA []byte) error { +func (m *QueryBlockCreateResultsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5590,17 +10210,17 @@ func (m *QueryAuthorizedAdminUpdateRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAuthorizedAdminUpdateRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlockCreateResultsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAuthorizedAdminUpdateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlockCreateResultsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var stringLen uint64 + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5610,24 +10230,11 @@ func (m *QueryAuthorizedAdminUpdateRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ContractAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5649,7 +10256,7 @@ func (m *QueryAuthorizedAdminUpdateRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAuthorizedAdminUpdateResponse) Unmarshal(dAtA []byte) error { +func (m *QueryBlockCreateResultsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5672,17 +10279,17 @@ func (m *QueryAuthorizedAdminUpdateResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAuthorizedAdminUpdateResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlockCreateResultsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAuthorizedAdminUpdateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlockCreateResultsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Results", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5692,23 +10299,25 @@ func (m *QueryAuthorizedAdminUpdateResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.NewAdmin = string(dAtA[iNdEx:postIndex]) + m.Results = append(m.Results, CreateResultData{}) + if err := m.Results[len(m.Results)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/compute/internal/types/query.pb.gw.go b/x/compute/internal/types/query.pb.gw.go index 77c481b20d..fb1e1fc5ed 100644 --- a/x/compute/internal/types/query.pb.gw.go +++ b/x/compute/internal/types/query.pb.gw.go @@ -682,13 +682,510 @@ func local_request_Query_AuthorizedAdminUpdate_0(ctx context.Context, marshaler } +func request_Query_EcallRecord_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEcallRecordRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := client.EcallRecord(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EcallRecord_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEcallRecordRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := server.EcallRecord(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_EcallRecords_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_EcallRecords_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEcallRecordsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EcallRecords_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EcallRecords(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EcallRecords_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEcallRecordsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EcallRecords_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EcallRecords(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_EncryptedSeed_0 = &utilities.DoubleArray{Encoding: map[string]int{"cert_hash": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_EncryptedSeed_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEncryptedSeedRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["cert_hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cert_hash") + } + + protoReq.CertHash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cert_hash", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EncryptedSeed_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.EncryptedSeed(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_EncryptedSeed_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEncryptedSeedRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["cert_hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "cert_hash") + } + + protoReq.CertHash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "cert_hash", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EncryptedSeed_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.EncryptedSeed(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_BlockTraces_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlockTracesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := client.BlockTraces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BlockTraces_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlockTracesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := server.BlockTraces(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_MachineIDProof_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMachineIDProofRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + val, ok = pathParams["machine_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "machine_id") + } + + protoReq.MachineId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "machine_id", err) + } + + msg, err := client.MachineIDProof(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_MachineIDProof_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryMachineIDProofRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + val, ok = pathParams["machine_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "machine_id") + } + + protoReq.MachineId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "machine_id", err) + } + + msg, err := server.MachineIDProof(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_AnalyzeCode_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_AnalyzeCode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAnalyzeCodeRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AnalyzeCode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AnalyzeCode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AnalyzeCode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAnalyzeCodeRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AnalyzeCode_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AnalyzeCode(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_BlockCreateResults_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlockCreateResultsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := client.BlockCreateResults(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BlockCreateResults_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBlockCreateResultsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + msg, err := server.BlockCreateResults(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ContractInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ContractsByCodeId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ContractsByCodeId_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ContractsByCodeId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_QuerySecretContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QuerySecretContract_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QuerySecretContract_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Code_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Codes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CodeHashByContractAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -699,7 +1196,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ContractInfo_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_CodeHashByContractAddress_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -707,11 +1204,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CodeHashByContractAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ContractsByCodeId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_CodeHashByCodeId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -722,7 +1219,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ContractsByCodeId_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_CodeHashByCodeId_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -730,11 +1227,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ContractsByCodeId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_CodeHashByCodeId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_QuerySecretContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LabelByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -745,7 +1242,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_QuerySecretContract_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_LabelByAddress_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -753,11 +1250,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_QuerySecretContract_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LabelByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_AddressByLabel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -768,7 +1265,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Code_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_AddressByLabel_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -776,11 +1273,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_AddressByLabel_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -791,7 +1288,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Codes_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ContractHistory_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -799,11 +1296,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_CodeHashByContractAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -814,7 +1311,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_CodeHashByContractAddress_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -822,11 +1319,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_CodeHashByContractAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_CodeHashByCodeId_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_AuthorizedMigration_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -837,7 +1334,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_CodeHashByCodeId_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_AuthorizedMigration_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -845,11 +1342,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_CodeHashByCodeId_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_AuthorizedMigration_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_LabelByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_AuthorizedAdminUpdate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -860,7 +1357,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_LabelByAddress_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_AuthorizedAdminUpdate_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -868,11 +1365,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_LabelByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_AuthorizedAdminUpdate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_AddressByLabel_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EcallRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -883,7 +1380,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_AddressByLabel_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_EcallRecord_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -891,11 +1388,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_AddressByLabel_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EcallRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EcallRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -906,7 +1403,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ContractHistory_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_EcallRecords_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -914,11 +1411,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EcallRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EncryptedSeed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -929,7 +1426,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_EncryptedSeed_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -937,11 +1434,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EncryptedSeed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_AuthorizedMigration_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BlockTraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -952,7 +1449,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_AuthorizedMigration_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_BlockTraces_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -960,11 +1457,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_AuthorizedMigration_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BlockTraces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_AuthorizedAdminUpdate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_MachineIDProof_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -975,7 +1472,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_AuthorizedAdminUpdate_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_MachineIDProof_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -983,7 +1480,53 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_AuthorizedAdminUpdate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_MachineIDProof_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AnalyzeCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AnalyzeCode_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AnalyzeCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BlockCreateResults_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BlockCreateResults_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BlockCreateResults_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1288,6 +1831,146 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_EcallRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_EcallRecord_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EcallRecord_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EcallRecords_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_EcallRecords_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EcallRecords_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_EncryptedSeed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_EncryptedSeed_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_EncryptedSeed_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BlockTraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BlockTraces_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BlockTraces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_MachineIDProof_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_MachineIDProof_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_MachineIDProof_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AnalyzeCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_AnalyzeCode_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AnalyzeCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BlockCreateResults_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BlockCreateResults_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BlockCreateResults_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1317,6 +2000,20 @@ var ( pattern_Query_AuthorizedMigration_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "authorized_migration", "contract_address"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_AuthorizedAdminUpdate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "authorized_admin_update", "contract_address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_EcallRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "ecall", "height"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_EcallRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"compute", "v1beta1", "ecalls"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_EncryptedSeed_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "encrypted_seed", "cert_hash"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BlockTraces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "block_traces", "height"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_MachineIDProof_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"compute", "v1beta1", "machine_id_proof", "height", "machine_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AnalyzeCode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"compute", "v1beta1", "analyze_code"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BlockCreateResults_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "block_create_results", "height"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1345,4 +2042,18 @@ var ( forward_Query_AuthorizedMigration_0 = runtime.ForwardResponseMessage forward_Query_AuthorizedAdminUpdate_0 = runtime.ForwardResponseMessage + + forward_Query_EcallRecord_0 = runtime.ForwardResponseMessage + + forward_Query_EcallRecords_0 = runtime.ForwardResponseMessage + + forward_Query_EncryptedSeed_0 = runtime.ForwardResponseMessage + + forward_Query_BlockTraces_0 = runtime.ForwardResponseMessage + + forward_Query_MachineIDProof_0 = runtime.ForwardResponseMessage + + forward_Query_AnalyzeCode_0 = runtime.ForwardResponseMessage + + forward_Query_BlockCreateResults_0 = runtime.ForwardResponseMessage ) diff --git a/x/compute/internal/types/types.go b/x/compute/internal/types/types.go index 2a6f0478a6..55851eb4a2 100644 --- a/x/compute/internal/types/types.go +++ b/x/compute/internal/types/types.go @@ -248,6 +248,10 @@ type WasmConfig struct { // It must always be true except the case when we create temporary app to // extract autoCLIOpts from it InitEnclave bool + // StoreSGXData enables storing SGX ecall data (ecall records and execution traces) + // for non-SGX node sync. When enabled, this node will store data that can be + // queried by non-SGX nodes via gRPC. Default: false (opt-in) + StoreSGXData bool } // DefaultWasmConfig returns the default settings for WasmConfig @@ -257,6 +261,7 @@ func DefaultWasmConfig() *WasmConfig { CacheSize: defaultLRUCacheSize, EnclaveCacheSize: defaultEnclaveLRUCacheSize, InitEnclave: true, + StoreSGXData: false, // Opt-in: validators choose to store/serve SGX data } } @@ -310,6 +315,10 @@ func GetConfig(appOpts servertypes.AppOptions) *WasmConfig { config.EnclaveCacheSize = enclaveCacheSize } + // Read store-sgx-data config (defaults to false if not set) + storeSGXData := cast.ToBool(appOpts.Get("wasm.store-sgx-data")) + config.StoreSGXData = storeSGXData + return config } @@ -326,6 +335,13 @@ contract-memory-cache-size = "{{ .WASMConfig.CacheSize }}" # The WASM VM memory cache size in number of cached modules. Can safely go up to 15, but not recommended for validators contract-memory-enclave-cache-size = "{{ .WASMConfig.EnclaveCacheSize }}" + +# Enable storing SGX ecall data for non-SGX node sync. +# When enabled, this node will store ecall records and execution traces +# that can be queried by non-SGX nodes via gRPC (port 9090). +# Validators who enable this should also open gRPC port 9090 in their firewall. +# Default: false (opt-in) +store-sgx-data = {{ .WASMConfig.StoreSGXData }} ` // ZeroSender is a valid 20 byte canonical address that's used to bypass the x/compute checks diff --git a/x/compute/module.go b/x/compute/module.go index af2fb113ab..5b6c9d9ece 100644 --- a/x/compute/module.go +++ b/x/compute/module.go @@ -3,6 +3,7 @@ package compute import ( "context" "encoding/json" + "time" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -18,7 +19,6 @@ import ( "github.com/scrtlabs/SecretNetwork/x/compute/client/cli" "github.com/scrtlabs/SecretNetwork/x/compute/internal/keeper" "github.com/scrtlabs/SecretNetwork/x/compute/internal/types" - tmenclave "github.com/scrtlabs/tm-secret-enclave" ) var ( @@ -157,6 +157,7 @@ func (am AppModule) BeginBlock(c context.Context) error { // Note: as of tendermint v0.38.0 block begin request info is no longer available ctx := c.(sdk.Context) block_header := ctx.BlockHeader() + height := ctx.BlockHeight() header, err := block_header.Marshal() if err != nil { @@ -171,24 +172,70 @@ func (am AppModule) BeginBlock(c context.Context) error { return err } + // Initialize block-scoped execution tracking + recorder := api.GetRecorder() + recorder.StartBlock(height) + // Note: Traces are fetched on-demand in replayExecution when needed, + // since they are created during execution on the SGX node + x2_data := scrt.UnFlatten(ctx.TxBytes()) - tm_data := tm_type.Data{Txs: x2_data} - data, err := tm_data.Marshal() - if err != nil { - ctx.Logger().Error("Failed to marshal tx data") - return err - } + if block_header.EncryptedRandom != nil { - randomAndProof := append(block_header.EncryptedRandom.Random, block_header.EncryptedRandom.Proof...) - random, validator_set_evidence, err := api.SubmitBlockSignatures(header, b_commit, data, randomAndProof) - if err != nil { - ctx.Logger().Error("Failed to submit block signatures") - return err + var random, validator_set_evidence []byte + + if recorder.IsReplayMode() { + // REPLAY MODE: Try to get from local DB first, then fetch from remote SGX node + var found bool + random, validator_set_evidence, found = recorder.ReplaySubmitBlockSignatures(height) + if !found { + // Try to fetch from remote SGX node. + // When non-SGX is in consensus processing the same block as SGX validators, + // the SGX node rejects with "height must be less than current height" until + // it commits the block. Wait and retry indefinitely — the data will eventually + // become available once the SGX node commits. + client := api.GetEcallClient() + const retryInterval = 2 * time.Second + var record *api.EcallRecordData + var err error + for { + record, err = client.FetchEcallRecord(height) + if err == nil { + break + } + ctx.Logger().Info("Waiting for SGX node ecall record, retrying...", "height", height, "error", err) + time.Sleep(retryInterval) + } + random = record.RandomSeed + validator_set_evidence = record.ValidatorSetEvidence + } + // else: found in local DB + } else { + // SGX MODE: Call enclave and record the result + tm_data := tm_type.Data{Txs: x2_data} + data, err := tm_data.Marshal() + if err != nil { + ctx.Logger().Error("Failed to marshal tx data") + return err + } + + randomAndProof := append(block_header.EncryptedRandom.Random, block_header.EncryptedRandom.Proof...) + random, validator_set_evidence, err = api.SubmitBlockSignatures(header, b_commit, data, randomAndProof) + if err != nil { + ctx.Logger().Error("Failed to submit block signatures") + return err + } + + // Record the result for non-SGX nodes + if err := recorder.RecordSubmitBlockSignatures(height, random, validator_set_evidence); err != nil { + ctx.Logger().Error("Failed to record SubmitBlockSignatures", "error", err) + // Don't fail the block for recording errors + } + } } am.keeper.SetRandomSeed(ctx, random, validator_set_evidence) } else { - ctx.Logger().Debug("Non-encrypted block", "Block_hash", block_header.LastBlockId.Hash, "Height", ctx.BlockHeight(), "Txs", len(x2_data)) + ctx.Logger().Debug("Non-encrypted block", "Block_hash", block_header.LastBlockId.Hash, "Height", height, "Txs", len(x2_data)) } return nil } @@ -215,6 +262,9 @@ func (am AppModule) EndBlock(c context.Context) error { ctx.Logger().Error("Failed to set scheduled txs %+v", err) // return err } + + // Prune old ecall records periodically + api.GetRecorder().PruneOldRecords(ctx.BlockHeight()) return nil } From d3f359fdeb53e7963d43ff2b4399d08bc7a034fd Mon Sep 17 00:00:00 2001 From: cboh4 Date: Tue, 31 Mar 2026 00:06:48 +0300 Subject: [PATCH 24/55] fix ce --- go-cosmwasm/api/lib.go | 4 ++++ go-cosmwasm/api/lib_nosgx.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index 0728dc365c..8e92e78246 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -165,6 +165,10 @@ func MigrationOp(op uint32) (bool, error) { return true, nil } +func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { + return nil, nil +} + func EmergencyApproveUpgrade(nodeDir string, msg string) (bool, error) { recorder := GetRecorder() if recorder.IsReplayMode() { diff --git a/go-cosmwasm/api/lib_nosgx.go b/go-cosmwasm/api/lib_nosgx.go index a0a0c38369..e48811b26c 100644 --- a/go-cosmwasm/api/lib_nosgx.go +++ b/go-cosmwasm/api/lib_nosgx.go @@ -289,6 +289,10 @@ func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { return nil, nil } +func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { + return nil, nil +} + func GetEncryptedSeed(cert []byte) ([]byte, error) { recorder := GetRecorder() certHash := sha256.Sum256(cert) From 672b3dd19400549918b733974a716f5d20d2ffac Mon Sep 17 00:00:00 2001 From: cboh4 Date: Wed, 8 Apr 2026 14:24:45 +0300 Subject: [PATCH 25/55] Update cosmos-sdk and tendermint versions for non-sgx --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f8655a898e..6324dca30a 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ replace ( cosmossdk.io/store => github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 cosmossdk.io/x/tx => github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.19-secret.11-non-sgx - github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.4-legacy-non-sgx + github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.10 github.com/cosmos/iavl => github.com/scrtlabs/iavl v1.2.2-secret.0 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 diff --git a/go.sum b/go.sum index b9568c0074..ef578177eb 100644 --- a/go.sum +++ b/go.sum @@ -1609,8 +1609,8 @@ github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWR github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.4-legacy-non-sgx h1:8w0Lvd4yjtvNAxLsxYJk5yqouzeyC+4mgcV6jFMXKGo= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.4-legacy-non-sgx/go.mod h1:fKGE9tKmIZlnEVNntZc4kn+KKXScO9Uq4Lcsm4G8fpg= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.10 h1:MJgXkosWs87TCy76l0cbxDUL4/7xlO1fKdFYPGKUkYM= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.10/go.mod h1:czzdPa3SiwDgWM0QqTZLKgwaF9k5w3rMS1kJzHIoGbQ= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 h1:9IGLySVhC2qSrxT3fZvvqwjKsnXWSSKnywQDzT8y1Gs= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 h1:TELtwBkSg0xBrs2ObFE0pVVWF6E31fPCDX2tk8OiJPo= From d1d05be52affbcd860d98330886147e581165847 Mon Sep 17 00:00:00 2001 From: cboh4 Date: Tue, 31 Mar 2026 00:42:46 +0300 Subject: [PATCH 26/55] wrap netkeys --- go-cosmwasm/api/ecall_client.go | 76 ++- go-cosmwasm/api/ecall_client_stub.go | 11 +- go-cosmwasm/api/ecall_record.go | 66 +- go-cosmwasm/api/ecall_record_stub.go | 13 +- go-cosmwasm/api/lib.go | 25 +- go-cosmwasm/api/lib_nosgx.go | 20 +- go.mod | 3 +- proto/secret/compute/v1beta1/query.proto | 19 + x/compute/internal/keeper/querier.go | 21 + x/compute/internal/types/query.pb.go | 818 ++++++++++++++++++----- x/compute/internal/types/query.pb.gw.go | 123 ++++ x/compute/module.go | 2 +- 12 files changed, 994 insertions(+), 203 deletions(-) diff --git a/go-cosmwasm/api/ecall_client.go b/go-cosmwasm/api/ecall_client.go index 129df58789..bc1c46a34b 100644 --- a/go-cosmwasm/api/ecall_client.go +++ b/go-cosmwasm/api/ecall_client.go @@ -78,9 +78,11 @@ type QueryEncryptedSeedRequest struct { Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` } -func (m *QueryEncryptedSeedRequest) Reset() { *m = QueryEncryptedSeedRequest{} } -func (m *QueryEncryptedSeedRequest) String() string { return fmt.Sprintf("{CertHash:%s,Height:%d}", m.CertHash, m.Height) } -func (m *QueryEncryptedSeedRequest) ProtoMessage() {} +func (m *QueryEncryptedSeedRequest) Reset() { *m = QueryEncryptedSeedRequest{} } +func (m *QueryEncryptedSeedRequest) String() string { + return fmt.Sprintf("{CertHash:%s,Height:%d}", m.CertHash, m.Height) +} +func (m *QueryEncryptedSeedRequest) ProtoMessage() {} // QueryEncryptedSeedResponse matches QueryEncryptedSeedResponse proto type QueryEncryptedSeedResponse struct { @@ -93,6 +95,30 @@ func (m *QueryEncryptedSeedResponse) String() string { } func (m *QueryEncryptedSeedResponse) ProtoMessage() {} +// QueryNetworkPubkeyRequest matches QueryNetworkPubkeyRequest proto +type QueryNetworkPubkeyRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + ISeed uint32 `protobuf:"varint,2,opt,name=i_seed,json=iSeed,proto3" json:"i_seed,omitempty"` +} + +func (m *QueryNetworkPubkeyRequest) Reset() { *m = QueryNetworkPubkeyRequest{} } +func (m *QueryNetworkPubkeyRequest) String() string { + return fmt.Sprintf("{Height:%d,ISeed:%d}", m.Height, m.ISeed) +} +func (m *QueryNetworkPubkeyRequest) ProtoMessage() {} + +// QueryNetworkPubkeyResponse matches QueryNetworkPubkeyResponse proto +type QueryNetworkPubkeyResponse struct { + NodePubkey []byte `protobuf:"bytes,1,opt,name=node_pubkey,json=nodePubkey,proto3" json:"node_pubkey,omitempty"` + IoPubkey []byte `protobuf:"bytes,2,opt,name=io_pubkey,json=ioPubkey,proto3" json:"io_pubkey,omitempty"` +} + +func (m *QueryNetworkPubkeyResponse) Reset() { *m = QueryNetworkPubkeyResponse{} } +func (m *QueryNetworkPubkeyResponse) String() string { + return fmt.Sprintf("{len(node):%d,len(io):%d}", len(m.NodePubkey), len(m.IoPubkey)) +} +func (m *QueryNetworkPubkeyResponse) ProtoMessage() {} + // StorageOpProto matches the proto definition for storage operation type StorageOpProto struct { IsDelete bool `protobuf:"varint,1,opt,name=is_delete,json=isDelete,proto3" json:"is_delete,omitempty"` @@ -167,9 +193,11 @@ type QueryAnalyzeCodeResponse struct { RequiredFeatures string `protobuf:"bytes,2,opt,name=required_features,json=requiredFeatures,proto3" json:"required_features,omitempty"` } -func (m *QueryAnalyzeCodeResponse) Reset() { *m = QueryAnalyzeCodeResponse{} } -func (m *QueryAnalyzeCodeResponse) String() string { return fmt.Sprintf("{HasIBC:%v}", m.HasIBCEntryPoints) } -func (m *QueryAnalyzeCodeResponse) ProtoMessage() {} +func (m *QueryAnalyzeCodeResponse) Reset() { *m = QueryAnalyzeCodeResponse{} } +func (m *QueryAnalyzeCodeResponse) String() string { + return fmt.Sprintf("{HasIBC:%v}", m.HasIBCEntryPoints) +} +func (m *QueryAnalyzeCodeResponse) ProtoMessage() {} // QueryMachineIDProofRequest matches QueryMachineIDProofRequest proto type QueryMachineIDProofRequest struct { @@ -177,9 +205,11 @@ type QueryMachineIDProofRequest struct { MachineId string `protobuf:"bytes,2,opt,name=machine_id,json=machineId,proto3" json:"machine_id,omitempty"` } -func (m *QueryMachineIDProofRequest) Reset() { *m = QueryMachineIDProofRequest{} } -func (m *QueryMachineIDProofRequest) String() string { return fmt.Sprintf("{Height:%d,MachineId:%s}", m.Height, m.MachineId) } -func (m *QueryMachineIDProofRequest) ProtoMessage() {} +func (m *QueryMachineIDProofRequest) Reset() { *m = QueryMachineIDProofRequest{} } +func (m *QueryMachineIDProofRequest) String() string { + return fmt.Sprintf("{Height:%d,MachineId:%s}", m.Height, m.MachineId) +} +func (m *QueryMachineIDProofRequest) ProtoMessage() {} // QueryMachineIDProofResponse matches QueryMachineIDProofResponse proto type QueryMachineIDProofResponse struct { @@ -223,12 +253,13 @@ func (m *QueryBlockCreateResultsResponse) String() string { func (m *QueryBlockCreateResultsResponse) ProtoMessage() {} const ( - methodEcallRecord = "/secret.compute.v1beta1.Query/EcallRecord" - methodEncryptedSeed = "/secret.compute.v1beta1.Query/EncryptedSeed" - methodBlockTraces = "/secret.compute.v1beta1.Query/BlockTraces" - methodAnalyzeCode = "/secret.compute.v1beta1.Query/AnalyzeCode" - methodMachineIDProof = "/secret.compute.v1beta1.Query/MachineIDProof" - methodBlockCreateResults = "/secret.compute.v1beta1.Query/BlockCreateResults" + methodEcallRecord = "/secret.compute.v1beta1.Query/EcallRecord" + methodEncryptedSeed = "/secret.compute.v1beta1.Query/EncryptedSeed" + methodBlockTraces = "/secret.compute.v1beta1.Query/BlockTraces" + methodAnalyzeCode = "/secret.compute.v1beta1.Query/AnalyzeCode" + methodMachineIDProof = "/secret.compute.v1beta1.Query/MachineIDProof" + methodBlockCreateResults = "/secret.compute.v1beta1.Query/BlockCreateResults" + methodNetworkPubkey = "/secret.compute.v1beta1.Query/NetworkPubkey" ) var ( @@ -252,6 +283,8 @@ var ( _ proto.Message = (*CreateResultDataProto)(nil) _ proto.Message = (*QueryBlockCreateResultsRequest)(nil) _ proto.Message = (*QueryBlockCreateResultsResponse)(nil) + _ proto.Message = (*QueryNetworkPubkeyRequest)(nil) + _ proto.Message = (*QueryNetworkPubkeyResponse)(nil) ) // GetEcallClient returns the global ecall client instance @@ -641,3 +674,16 @@ func (c *EcallClient) FetchBlockCreateResults(height int64) ([]*CreateResult, [] } return results, wasmHashes, nil } + +// FetchNetworkPubkey fetches a stored network pubkey from a random SGX node +func (c *EcallClient) FetchNetworkPubkey(height int64, iSeed uint32) ([]byte, []byte, error) { + req := &QueryNetworkPubkeyRequest{Height: height, ISeed: iSeed} + resp := &QueryNetworkPubkeyResponse{} + + if err := c.invokeWithRetry(methodNetworkPubkey, req, resp); err != nil { + return nil, nil, fmt.Errorf("gRPC NetworkPubkey failed for height %d seed %d: %w", height, iSeed, err) + } + + logInfo("EcallClient", "Fetched NetworkPubkey for height %d seed %d", height, iSeed) + return resp.NodePubkey, resp.IoPubkey, nil +} diff --git a/go-cosmwasm/api/ecall_client_stub.go b/go-cosmwasm/api/ecall_client_stub.go index f77cf9ba6b..30a320395e 100644 --- a/go-cosmwasm/api/ecall_client_stub.go +++ b/go-cosmwasm/api/ecall_client_stub.go @@ -19,7 +19,10 @@ func GetEcallClient() *EcallClient { retur func (c *EcallClient) FetchEcallRecord(int64) (*EcallRecordData, error) { return nil, nil } func (c *EcallClient) FetchEncryptedSeed(int64, string) ([]byte, error) { return nil, nil } func (c *EcallClient) FetchBlockTraces(int64) ([]*ExecutionTrace, error) { return nil, nil } -func (c *EcallClient) FetchBlockCreateResults(int64) ([]*CreateResult, [][]byte, error) { return nil, nil, nil } -func (c *EcallClient) Close() error { return nil } -func (c *EcallClient) SetGrpcAddr(string) error { return nil } -func (c *EcallClient) IsConnected() bool { return false } +func (c *EcallClient) FetchBlockCreateResults(int64) ([]*CreateResult, [][]byte, error) { + return nil, nil, nil +} +func (c *EcallClient) FetchNetworkPubkey(int64, uint32) ([]byte, []byte, error) { return nil, nil, nil } +func (c *EcallClient) Close() error { return nil } +func (c *EcallClient) SetGrpcAddr(string) error { return nil } +func (c *EcallClient) IsConnected() bool { return false } diff --git a/go-cosmwasm/api/ecall_record.go b/go-cosmwasm/api/ecall_record.go index d8fa302355..3f00a934e0 100644 --- a/go-cosmwasm/api/ecall_record.go +++ b/go-cosmwasm/api/ecall_record.go @@ -59,6 +59,7 @@ var ( prefixMachineIDProof = []byte{0x04} // For MachineID approval: prefix | height | machineID prefixCreateResult = []byte{0x05} // For Create (store code): prefix | height | sha256(wasm) prefixGetEncryptedSeedErr = []byte{0x06} // For GetEncryptedSeed errors: prefix | certHash + prefixGetNetworkPubkey = []byte{0x07} // For GetNetworkPubkey: prefix | height | i_seed ) // CrossModuleOp represents a write to a module store other than the contract's @@ -80,7 +81,7 @@ type ExecutionTrace struct { GasUsed uint64 // Gas reported by the enclave CallbackGas uint64 // Total gas consumed by callbacks (store ops) during execution HasError bool - IsOutOfGas bool // True when the enclave returned errno==2 (OutOfGas) + IsOutOfGas bool // True when the enclave returned errno==2 (OutOfGas) ErrorMsg string } @@ -383,6 +384,69 @@ func (r *EcallRecorder) ReplayMachineIDProof(height int64, machineID []byte) (pr return value, true } +// --- GetNetworkPubkey recording --- + +func makeNetworkPubkeyKey(height int64, iSeed uint32) []byte { + key := make([]byte, 1+8+4) + key[0] = prefixGetNetworkPubkey[0] + binary.BigEndian.PutUint64(key[1:9], uint64(height)) + binary.BigEndian.PutUint32(key[9:13], iSeed) + return key +} + +func (r *EcallRecorder) RecordGetNetworkPubkey(height int64, iSeed uint32, nodePk, ioPk []byte) error { + if r.db == nil { + return nil + } + + r.mu.Lock() + defer r.mu.Unlock() + + // Pack lengths + data + value := make([]byte, 2+len(nodePk)+2+len(ioPk)) + binary.BigEndian.PutUint16(value[0:2], uint16(len(nodePk))) + copy(value[2:2+len(nodePk)], nodePk) + + offset := 2 + len(nodePk) + binary.BigEndian.PutUint16(value[offset:offset+2], uint16(len(ioPk))) + copy(value[offset+2:], ioPk) + + key := makeNetworkPubkeyKey(height, iSeed) + if err := r.db.Set(key, value); err != nil { + return fmt.Errorf("failed to write network pubkey to db: %w", err) + } + + logInfo("EcallRecorder", "Recorded GetNetworkPubkey at height %d for i_seed %d", height, iSeed) + return nil +} + +func (r *EcallRecorder) ReplayGetNetworkPubkey(height int64, iSeed uint32) (nodePk, ioPk []byte, found bool) { + if r.db == nil { + return nil, nil, false + } + + r.mu.RLock() + defer r.mu.RUnlock() + + key := makeNetworkPubkeyKey(height, iSeed) + value, err := r.db.Get(key) + if err != nil || value == nil { + return nil, nil, false + } + + nodePkLen := binary.BigEndian.Uint16(value[0:2]) + nodePk = make([]byte, nodePkLen) + copy(nodePk, value[2:2+nodePkLen]) + + offset := 2 + nodePkLen + ioPkLen := binary.BigEndian.Uint16(value[offset : offset+2]) + ioPk = make([]byte, ioPkLen) + copy(ioPk, value[offset+2:]) + + logInfo("EcallRecorder", "Replayed GetNetworkPubkey at height %d for i_seed %d", height, iSeed) + return nodePk, ioPk, true +} + // --- GetEncryptedSeed recording (by height + cert hash) --- // makeSeedKey creates a key: prefix(1) | height(8) | certHash diff --git a/go-cosmwasm/api/ecall_record_stub.go b/go-cosmwasm/api/ecall_record_stub.go index b0f5b90ed4..26f0ed4ab2 100644 --- a/go-cosmwasm/api/ecall_record_stub.go +++ b/go-cosmwasm/api/ecall_record_stub.go @@ -121,8 +121,8 @@ func (r *EcallRecorder) SetBlockTraces(traces []*ExecutionTrace) func (r *EcallRecorder) GetTraceFromMemory(index int64) (*ExecutionTrace, bool) { return nil, false } // Cross-module ops stubs -func (r *EcallRecorder) SetPendingCrossModuleOps(ops []CrossModuleOp) {} -func (r *EcallRecorder) AppendCrossModuleOp(op CrossModuleOp) {} +func (r *EcallRecorder) SetPendingCrossModuleOps(ops []CrossModuleOp) {} +func (r *EcallRecorder) AppendCrossModuleOp(op CrossModuleOp) {} func (r *EcallRecorder) GetAndClearPendingCrossModuleOps() []CrossModuleOp { return nil } // CreateResult stores the outcome of an SGX Create call @@ -136,10 +136,19 @@ type CreateResult struct { func (r *EcallRecorder) RecordCreateResult(height int64, wasmHash []byte, codeHash []byte, errMsg string) error { return nil } + func (r *EcallRecorder) ReplayCreateResult(height int64, wasmHash []byte) (codeHash []byte, errMsg string, found bool) { return nil, "", false } + func (r *EcallRecorder) GetAllCreateResultsForBlock(height int64) ([]*CreateResult, [][]byte, error) { return nil, nil, nil } +func (r *EcallRecorder) RecordGetNetworkPubkey(height int64, iSeed uint32, nodePk, ioPk []byte) error { + return nil +} + +func (r *EcallRecorder) ReplayGetNetworkPubkey(height int64, iSeed uint32) ([]byte, []byte, bool) { + return nil, nil, false +} diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index 8e92e78246..6f6f144b36 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -96,7 +96,6 @@ func InitBootstrap() ([]byte, error) { logInfo("InitBootstrap", "Skipped in replay mode") return make([]byte, 32), nil } - errmsg := C.Buffer{} res, err := C.init_bootstrap(&errmsg) if err != nil { @@ -112,7 +111,6 @@ func LoadSeedToEnclave(masterKey []byte, seed []byte) (bool, error) { logInfo("LoadSeedToEnclave", "Skipped in replay mode") return true, nil } - pkSlice := sendSlice(masterKey) defer freeAfterSend(pkSlice) seedSlice := sendSlice(seed) @@ -166,7 +164,24 @@ func MigrationOp(op uint32) (bool, error) { } func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { - return nil, nil + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() + + if recorder.IsReplayMode() { + nodePk, ioPk, err := GetEcallClient().FetchNetworkPubkey(height, i_seed) + if err != nil { + logError("GetNetworkPubkey", "Failed to fetch on replay: %v", err) + return nil, nil + } + return nodePk, ioPk + } + + res := C.get_network_pubkey(u32(i_seed)) + nodePk := receiveVector(res.buf1) + ioPk := receiveVector(res.buf2) + + _ = recorder.RecordGetNetworkPubkey(height, i_seed, nodePk, ioPk) + return nodePk, ioPk } func EmergencyApproveUpgrade(nodeDir string, msg string) (bool, error) { @@ -886,16 +901,14 @@ func KeyGen() ([]byte, error) { return receiveVector(res), nil } +// CreateAttestationReport Send request to enclave func CreateAttestationReport(ext_sk []byte, is_migration_report bool) (bool, error) { -// CreateAttestationReport Send CreateAttestationReport request to enclave -func CreateAttestationReport(no_epid bool, no_dcap bool, is_migration_report bool) (bool, error) { recorder := GetRecorder() if recorder.IsReplayMode() { // In replay mode, skip attestation report creation (no SGX) logInfo("CreateAttestationReport", "Skipped in replay mode") return true, nil } - errmsg := C.Buffer{} flags := u32(0) diff --git a/go-cosmwasm/api/lib_nosgx.go b/go-cosmwasm/api/lib_nosgx.go index e48811b26c..e83a761fe8 100644 --- a/go-cosmwasm/api/lib_nosgx.go +++ b/go-cosmwasm/api/lib_nosgx.go @@ -23,11 +23,11 @@ func HealthCheck() ([]byte, error) { return []byte("replay"), nil } -func InitBootstrap(spid []byte, apiKey []byte) ([]byte, error) { +func InitBootstrap() ([]byte, error) { return nil, nil } -func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom []byte, cronMsgs []byte) ([]byte, []byte, error) { +func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom []byte) ([]byte, []byte, error) { return nil, nil, errors.New("submit block signatures not supported on non-SGX node") } @@ -36,7 +36,7 @@ func SubmitValidatorSetEvidence(evidence []byte) error { return nil } -func LoadSeedToEnclave(masterKey []byte, seed []byte, apiKey []byte) (bool, error) { +func LoadSeedToEnclave(masterKey []byte, seed []byte) (bool, error) { return true, nil } @@ -280,17 +280,21 @@ func KeyGen() ([]byte, error) { return make([]byte, 32), nil } -func CreateAttestationReport(no_epid bool, no_dcap bool, is_migration_report bool) (bool, error) { +func CreateAttestationReport(is_migration_report bool) (bool, error) { logInfo("CreateAttestationReport", "Skipped in replay mode") return true, nil } func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { - return nil, nil -} + recorder := GetRecorder() + height := recorder.GetCurrentBlockHeight() -func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { - return nil, nil + nodePk, ioPk, err := GetEcallClient().FetchNetworkPubkey(height, i_seed) + if err != nil { + logError("GetNetworkPubkey", "Failed to fetch on replay: %v", err) + return nil, nil + } + return nodePk, ioPk } func GetEncryptedSeed(cert []byte) ([]byte, error) { diff --git a/go.mod b/go.mod index 6324dca30a..f1709447d3 100644 --- a/go.mod +++ b/go.mod @@ -62,6 +62,7 @@ require ( require ( cosmossdk.io/api v0.7.6 + cosmossdk.io/client/v2 v2.0.0-beta.3 cosmossdk.io/collections v0.4.0 cosmossdk.io/math v1.4.0 cosmossdk.io/tools/confix v0.1.2 @@ -75,6 +76,7 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golang/mock v1.6.0 github.com/hashicorp/go-metrics v0.5.3 + github.com/scrtlabs/tm-secret-enclave v1.13.1 golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 gopkg.in/yaml.v2 v2.4.0 ) @@ -200,7 +202,6 @@ require ( github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/sasha-s/go-deadlock v0.3.5 // indirect - github.com/scrtlabs/tm-secret-enclave v1.13.1 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect diff --git a/proto/secret/compute/v1beta1/query.proto b/proto/secret/compute/v1beta1/query.proto index 8223b9c9a4..ad2b334c39 100644 --- a/proto/secret/compute/v1beta1/query.proto +++ b/proto/secret/compute/v1beta1/query.proto @@ -89,6 +89,11 @@ service Query { option (google.api.http).get = "/compute/v1beta1/ecalls"; } + // Query network pubkey by block height and seed index (for non-SGX node sync) + rpc NetworkPubkey(QueryNetworkPubkeyRequest) returns (QueryNetworkPubkeyResponse) { + option (google.api.http).get = "/compute/v1beta1/network_pubkey/{height}/{i_seed}"; + } + // Query encrypted seed by certificate hash (for non-SGX node sync) rpc EncryptedSeed(QueryEncryptedSeedRequest) returns (QueryEncryptedSeedResponse) { option (google.api.http).get = "/compute/v1beta1/encrypted_seed/{cert_hash}"; @@ -268,6 +273,20 @@ message QueryEcallRecordResponse { bytes validator_set_evidence = 3; } +// QueryNetworkPubkeyRequest is the request type for the Query/NetworkPubkey RPC +message QueryNetworkPubkeyRequest { + // Block height to query network pubkey for + int64 height = 1; + // Seed index + uint32 i_seed = 2; +} + +// QueryNetworkPubkeyResponse is the response type for the Query/NetworkPubkey RPC +message QueryNetworkPubkeyResponse { + bytes node_pubkey = 1; + bytes io_pubkey = 2; +} + // QueryEcallRecordsRequest is the request type for the Query/EcallRecords RPC method message QueryEcallRecordsRequest { // Start block height (inclusive) diff --git a/x/compute/internal/keeper/querier.go b/x/compute/internal/keeper/querier.go index a7073c5ca8..04cc223a01 100644 --- a/x/compute/internal/keeper/querier.go +++ b/x/compute/internal/keeper/querier.go @@ -283,6 +283,27 @@ func (q GrpcQuerier) AuthorizedAdminUpdate(c context.Context, req *types.QueryAu // EcallRecord returns the ecall record for a specific block height // This is used by non-SGX nodes to sync with the network // SECURITY: Only returns data for heights < current height (prevents non-SGX nodes from participating in consensus) +func (q GrpcQuerier) NetworkPubkey(c context.Context, req *types.QueryNetworkPubkeyRequest) (*types.QueryNetworkPubkeyResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + recorder := api.GetRecorder() + if !recorder.IsSGXMode() { + return nil, status.Error(codes.FailedPrecondition, "NetworkPubkey query is only available on SGX nodes") + } + + nodePk, ioPk, found := recorder.ReplayGetNetworkPubkey(req.Height, req.ISeed) + if !found { + return nil, status.Errorf(codes.NotFound, "No network pubkey recorded for height %d seed %d", req.Height, req.ISeed) + } + + return &types.QueryNetworkPubkeyResponse{ + NodePubkey: nodePk, + IoPubkey: ioPk, + }, nil +} + func (q GrpcQuerier) EcallRecord(c context.Context, req *types.QueryEcallRecordRequest) (*types.QueryEcallRecordResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") diff --git a/x/compute/internal/types/query.pb.go b/x/compute/internal/types/query.pb.go index 0d1de28b35..e1036a42b0 100644 --- a/x/compute/internal/types/query.pb.go +++ b/x/compute/internal/types/query.pb.go @@ -1039,6 +1039,86 @@ func (m *QueryEcallRecordResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEcallRecordResponse proto.InternalMessageInfo +// QueryNetworkPubkeyRequest is the request type for the Query/NetworkPubkey RPC +type QueryNetworkPubkeyRequest struct { + // Block height to query network pubkey for + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + // Seed index + ISeed uint32 `protobuf:"varint,2,opt,name=i_seed,json=iSeed,proto3" json:"i_seed,omitempty"` +} + +func (m *QueryNetworkPubkeyRequest) Reset() { *m = QueryNetworkPubkeyRequest{} } +func (m *QueryNetworkPubkeyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryNetworkPubkeyRequest) ProtoMessage() {} +func (*QueryNetworkPubkeyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{26} +} +func (m *QueryNetworkPubkeyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNetworkPubkeyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNetworkPubkeyRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryNetworkPubkeyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNetworkPubkeyRequest.Merge(m, src) +} +func (m *QueryNetworkPubkeyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryNetworkPubkeyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNetworkPubkeyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryNetworkPubkeyRequest proto.InternalMessageInfo + +// QueryNetworkPubkeyResponse is the response type for the Query/NetworkPubkey RPC +type QueryNetworkPubkeyResponse struct { + NodePubkey []byte `protobuf:"bytes,1,opt,name=node_pubkey,json=nodePubkey,proto3" json:"node_pubkey,omitempty"` + IoPubkey []byte `protobuf:"bytes,2,opt,name=io_pubkey,json=ioPubkey,proto3" json:"io_pubkey,omitempty"` +} + +func (m *QueryNetworkPubkeyResponse) Reset() { *m = QueryNetworkPubkeyResponse{} } +func (m *QueryNetworkPubkeyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryNetworkPubkeyResponse) ProtoMessage() {} +func (*QueryNetworkPubkeyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7735281c5fa969d4, []int{27} +} +func (m *QueryNetworkPubkeyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNetworkPubkeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNetworkPubkeyResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryNetworkPubkeyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNetworkPubkeyResponse.Merge(m, src) +} +func (m *QueryNetworkPubkeyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryNetworkPubkeyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNetworkPubkeyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryNetworkPubkeyResponse proto.InternalMessageInfo + // QueryEcallRecordsRequest is the request type for the Query/EcallRecords RPC method type QueryEcallRecordsRequest struct { // Start block height (inclusive) @@ -1051,7 +1131,7 @@ func (m *QueryEcallRecordsRequest) Reset() { *m = QueryEcallRecordsReque func (m *QueryEcallRecordsRequest) String() string { return proto.CompactTextString(m) } func (*QueryEcallRecordsRequest) ProtoMessage() {} func (*QueryEcallRecordsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{26} + return fileDescriptor_7735281c5fa969d4, []int{28} } func (m *QueryEcallRecordsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1090,7 +1170,7 @@ func (m *QueryEcallRecordsResponse) Reset() { *m = QueryEcallRecordsResp func (m *QueryEcallRecordsResponse) String() string { return proto.CompactTextString(m) } func (*QueryEcallRecordsResponse) ProtoMessage() {} func (*QueryEcallRecordsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{27} + return fileDescriptor_7735281c5fa969d4, []int{29} } func (m *QueryEcallRecordsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1131,7 +1211,7 @@ func (m *QueryEncryptedSeedRequest) Reset() { *m = QueryEncryptedSeedReq func (m *QueryEncryptedSeedRequest) String() string { return proto.CompactTextString(m) } func (*QueryEncryptedSeedRequest) ProtoMessage() {} func (*QueryEncryptedSeedRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{28} + return fileDescriptor_7735281c5fa969d4, []int{30} } func (m *QueryEncryptedSeedRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1170,7 +1250,7 @@ func (m *QueryEncryptedSeedResponse) Reset() { *m = QueryEncryptedSeedRe func (m *QueryEncryptedSeedResponse) String() string { return proto.CompactTextString(m) } func (*QueryEncryptedSeedResponse) ProtoMessage() {} func (*QueryEncryptedSeedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{29} + return fileDescriptor_7735281c5fa969d4, []int{31} } func (m *QueryEncryptedSeedResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1213,7 +1293,7 @@ func (m *StorageOp) Reset() { *m = StorageOp{} } func (m *StorageOp) String() string { return proto.CompactTextString(m) } func (*StorageOp) ProtoMessage() {} func (*StorageOp) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{30} + return fileDescriptor_7735281c5fa969d4, []int{32} } func (m *StorageOp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1258,7 +1338,7 @@ func (m *CrossModuleOp) Reset() { *m = CrossModuleOp{} } func (m *CrossModuleOp) String() string { return proto.CompactTextString(m) } func (*CrossModuleOp) ProtoMessage() {} func (*CrossModuleOp) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{31} + return fileDescriptor_7735281c5fa969d4, []int{33} } func (m *CrossModuleOp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1311,7 +1391,7 @@ func (m *ExecutionTraceData) Reset() { *m = ExecutionTraceData{} } func (m *ExecutionTraceData) String() string { return proto.CompactTextString(m) } func (*ExecutionTraceData) ProtoMessage() {} func (*ExecutionTraceData) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{32} + return fileDescriptor_7735281c5fa969d4, []int{34} } func (m *ExecutionTraceData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1350,7 +1430,7 @@ func (m *QueryBlockTracesRequest) Reset() { *m = QueryBlockTracesRequest func (m *QueryBlockTracesRequest) String() string { return proto.CompactTextString(m) } func (*QueryBlockTracesRequest) ProtoMessage() {} func (*QueryBlockTracesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{33} + return fileDescriptor_7735281c5fa969d4, []int{35} } func (m *QueryBlockTracesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1389,7 +1469,7 @@ func (m *QueryBlockTracesResponse) Reset() { *m = QueryBlockTracesRespon func (m *QueryBlockTracesResponse) String() string { return proto.CompactTextString(m) } func (*QueryBlockTracesResponse) ProtoMessage() {} func (*QueryBlockTracesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{34} + return fileDescriptor_7735281c5fa969d4, []int{36} } func (m *QueryBlockTracesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1430,7 +1510,7 @@ func (m *QueryMachineIDProofRequest) Reset() { *m = QueryMachineIDProofR func (m *QueryMachineIDProofRequest) String() string { return proto.CompactTextString(m) } func (*QueryMachineIDProofRequest) ProtoMessage() {} func (*QueryMachineIDProofRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{35} + return fileDescriptor_7735281c5fa969d4, []int{37} } func (m *QueryMachineIDProofRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1469,7 +1549,7 @@ func (m *QueryMachineIDProofResponse) Reset() { *m = QueryMachineIDProof func (m *QueryMachineIDProofResponse) String() string { return proto.CompactTextString(m) } func (*QueryMachineIDProofResponse) ProtoMessage() {} func (*QueryMachineIDProofResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{36} + return fileDescriptor_7735281c5fa969d4, []int{38} } func (m *QueryMachineIDProofResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1508,7 +1588,7 @@ func (m *QueryAnalyzeCodeRequest) Reset() { *m = QueryAnalyzeCodeRequest func (m *QueryAnalyzeCodeRequest) String() string { return proto.CompactTextString(m) } func (*QueryAnalyzeCodeRequest) ProtoMessage() {} func (*QueryAnalyzeCodeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{37} + return fileDescriptor_7735281c5fa969d4, []int{39} } func (m *QueryAnalyzeCodeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1549,7 +1629,7 @@ func (m *QueryAnalyzeCodeResponse) Reset() { *m = QueryAnalyzeCodeRespon func (m *QueryAnalyzeCodeResponse) String() string { return proto.CompactTextString(m) } func (*QueryAnalyzeCodeResponse) ProtoMessage() {} func (*QueryAnalyzeCodeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{38} + return fileDescriptor_7735281c5fa969d4, []int{40} } func (m *QueryAnalyzeCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1594,7 +1674,7 @@ func (m *CreateResultData) Reset() { *m = CreateResultData{} } func (m *CreateResultData) String() string { return proto.CompactTextString(m) } func (*CreateResultData) ProtoMessage() {} func (*CreateResultData) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{39} + return fileDescriptor_7735281c5fa969d4, []int{41} } func (m *CreateResultData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1633,7 +1713,7 @@ func (m *QueryBlockCreateResultsRequest) Reset() { *m = QueryBlockCreate func (m *QueryBlockCreateResultsRequest) String() string { return proto.CompactTextString(m) } func (*QueryBlockCreateResultsRequest) ProtoMessage() {} func (*QueryBlockCreateResultsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{40} + return fileDescriptor_7735281c5fa969d4, []int{42} } func (m *QueryBlockCreateResultsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1672,7 +1752,7 @@ func (m *QueryBlockCreateResultsResponse) Reset() { *m = QueryBlockCreat func (m *QueryBlockCreateResultsResponse) String() string { return proto.CompactTextString(m) } func (*QueryBlockCreateResultsResponse) ProtoMessage() {} func (*QueryBlockCreateResultsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7735281c5fa969d4, []int{41} + return fileDescriptor_7735281c5fa969d4, []int{43} } func (m *QueryBlockCreateResultsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1728,6 +1808,8 @@ func init() { proto.RegisterType((*QueryAuthorizedAdminUpdateResponse)(nil), "secret.compute.v1beta1.QueryAuthorizedAdminUpdateResponse") proto.RegisterType((*QueryEcallRecordRequest)(nil), "secret.compute.v1beta1.QueryEcallRecordRequest") proto.RegisterType((*QueryEcallRecordResponse)(nil), "secret.compute.v1beta1.QueryEcallRecordResponse") + proto.RegisterType((*QueryNetworkPubkeyRequest)(nil), "secret.compute.v1beta1.QueryNetworkPubkeyRequest") + proto.RegisterType((*QueryNetworkPubkeyResponse)(nil), "secret.compute.v1beta1.QueryNetworkPubkeyResponse") proto.RegisterType((*QueryEcallRecordsRequest)(nil), "secret.compute.v1beta1.QueryEcallRecordsRequest") proto.RegisterType((*QueryEcallRecordsResponse)(nil), "secret.compute.v1beta1.QueryEcallRecordsResponse") proto.RegisterType((*QueryEncryptedSeedRequest)(nil), "secret.compute.v1beta1.QueryEncryptedSeedRequest") @@ -1751,155 +1833,161 @@ func init() { } var fileDescriptor_7735281c5fa969d4 = []byte{ - // 2355 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0x4b, 0x6c, 0x1c, 0x49, - 0x19, 0x76, 0xfb, 0x3d, 0xe5, 0x47, 0x92, 0x5a, 0xc7, 0x71, 0x26, 0x9b, 0x71, 0x52, 0x6c, 0x12, - 0x27, 0xd9, 0x4c, 0xc7, 0x4e, 0xc8, 0x8b, 0x45, 0x60, 0x3b, 0x86, 0x18, 0xf2, 0xf0, 0x8e, 0x77, - 0x85, 0x84, 0x82, 0x5a, 0x35, 0xdd, 0x95, 0x99, 0x96, 0x67, 0xba, 0x27, 0x5d, 0x35, 0xb6, 0x67, - 0x23, 0x73, 0xe0, 0x80, 0xe0, 0x86, 0xc4, 0x22, 0xb4, 0xe2, 0xb2, 0x27, 0x58, 0x81, 0x84, 0xc4, - 0x75, 0x25, 0xc4, 0x35, 0x42, 0x1c, 0x22, 0xe5, 0xc2, 0x29, 0x82, 0x84, 0x03, 0xe2, 0xce, 0x1d, - 0xd5, 0x5f, 0xd5, 0x3d, 0xdd, 0x33, 0x3d, 0xd3, 0xe3, 0x70, 0xd8, 0xdb, 0x74, 0xd5, 0xff, 0xf8, - 0xfe, 0x47, 0xfd, 0xf5, 0xff, 0x35, 0x88, 0x70, 0x66, 0x07, 0x4c, 0x98, 0xb6, 0x5f, 0x6f, 0x34, - 0x05, 0x33, 0x77, 0x97, 0xcb, 0x4c, 0xd0, 0x65, 0xf3, 0x69, 0x93, 0x05, 0xad, 0x62, 0x23, 0xf0, - 0x85, 0x8f, 0xe7, 0x15, 0x4d, 0x51, 0xd3, 0x14, 0x35, 0x4d, 0x7e, 0xae, 0xe2, 0x57, 0x7c, 0x20, - 0x31, 0xe5, 0x2f, 0x45, 0x9d, 0xef, 0x25, 0x51, 0xb4, 0x1a, 0x8c, 0x6b, 0x9a, 0xaf, 0xf5, 0xa0, - 0x69, 0xd0, 0x80, 0xd6, 0x43, 0xa2, 0x53, 0x15, 0xdf, 0xaf, 0xd4, 0x98, 0x09, 0x5f, 0xe5, 0xe6, - 0x13, 0x93, 0xd5, 0x1b, 0x42, 0x63, 0xca, 0xbf, 0xab, 0x37, 0x69, 0xc3, 0x35, 0xa9, 0xe7, 0xf9, - 0x82, 0x0a, 0xd7, 0xf7, 0x22, 0xf9, 0xb6, 0xcf, 0xeb, 0x3e, 0x37, 0xcb, 0x94, 0x33, 0x93, 0x96, - 0x6d, 0x37, 0xd2, 0x20, 0x3f, 0x34, 0xd1, 0xa5, 0x38, 0x11, 0xd8, 0x1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 0xee, 0xf1, 0x07, 0xdf, 0xc8, 0x8e, 0x67, 0xda, 0xa4, - 0x95, 0xbf, 0x79, 0x68, 0x3e, 0x0d, 0xf7, 0x06, 0xc0, 0xbd, 0x8a, 0x8b, 0x3d, 0xd2, 0x01, 0xfe, - 0xe3, 0x61, 0x96, 0x1e, 0xa6, 0x22, 0x37, 0xaf, 0x3d, 0x7e, 0xfe, 0xcf, 0xc2, 0xd0, 0x17, 0xaf, - 0x0b, 0xc6, 0xf3, 0xd7, 0x05, 0xe3, 0xc5, 0xeb, 0x82, 0xf1, 0x8f, 0xd7, 0x05, 0xe3, 0x17, 0x6f, - 0x0a, 0x43, 0x2f, 0xde, 0x14, 0x86, 0xfe, 0xfe, 0xa6, 0x30, 0xf4, 0xc3, 0x3b, 0x15, 0x57, 0x54, - 0x9b, 0x65, 0x89, 0xc8, 0xe4, 0x76, 0x20, 0x6a, 0xb4, 0xcc, 0x4d, 0xd5, 0xc1, 0x3f, 0x64, 0x62, - 0xcf, 0x0f, 0x76, 0xcc, 0xfd, 0x48, 0xa9, 0xeb, 0x09, 0x16, 0x78, 0xb4, 0xa6, 0xfe, 0xad, 0x2e, - 0x8f, 0x43, 0x0b, 0x7c, 0xed, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xae, 0xfe, 0x00, 0x23, 0x26, - 0x1f, 0x00, 0x00, + // 2453 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4b, 0x6c, 0x1c, 0x49, + 0x19, 0x76, 0xfb, 0x3d, 0xbf, 0x1f, 0x49, 0x6a, 0x1d, 0xc7, 0x99, 0x6c, 0xc6, 0x9b, 0x62, 0xb3, + 0x71, 0x92, 0xcd, 0x74, 0x6c, 0x87, 0xbc, 0x58, 0x04, 0xb6, 0x63, 0x88, 0x97, 0x3c, 0xbc, 0xe3, + 0x5d, 0x21, 0xad, 0x82, 0x5a, 0x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, 0xa9, 0x37, 0x0f, 0x22, 0xa5, 0xae, 0xc7, 0x69, 0xe0, 0x91, 0x9a, 0xfa, + 0x4f, 0x80, 0xf2, 0xb8, 0x7c, 0xb6, 0xaf, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0x6f, 0x24, 0x31, + 0x57, 0x82, 0x20, 0x00, 0x00, } func (this *ParamsRequest) Equal(that interface{}) bool { @@ -2443,6 +2531,60 @@ func (this *QueryEcallRecordResponse) Equal(that interface{}) bool { } return true } +func (this *QueryNetworkPubkeyRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryNetworkPubkeyRequest) + if !ok { + that2, ok := that.(QueryNetworkPubkeyRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Height != that1.Height { + return false + } + if this.ISeed != that1.ISeed { + return false + } + return true +} +func (this *QueryNetworkPubkeyResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*QueryNetworkPubkeyResponse) + if !ok { + that2, ok := that.(QueryNetworkPubkeyResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.NodePubkey, that1.NodePubkey) { + return false + } + if !bytes.Equal(this.IoPubkey, that1.IoPubkey) { + return false + } + return true +} func (this *QueryEcallRecordsRequest) Equal(that interface{}) bool { if that == nil { return this == nil @@ -2953,6 +3095,8 @@ type QueryClient interface { EcallRecord(ctx context.Context, in *QueryEcallRecordRequest, opts ...grpc.CallOption) (*QueryEcallRecordResponse, error) // Query ecall records for a range of block heights (batch sync) EcallRecords(ctx context.Context, in *QueryEcallRecordsRequest, opts ...grpc.CallOption) (*QueryEcallRecordsResponse, error) + // Query network pubkey by block height and seed index (for non-SGX node sync) + NetworkPubkey(ctx context.Context, in *QueryNetworkPubkeyRequest, opts ...grpc.CallOption) (*QueryNetworkPubkeyResponse, error) // Query encrypted seed by certificate hash (for non-SGX node sync) EncryptedSeed(ctx context.Context, in *QueryEncryptedSeedRequest, opts ...grpc.CallOption) (*QueryEncryptedSeedResponse, error) // Query all execution traces for a block (batch fetch for non-SGX node sync) @@ -3108,6 +3252,15 @@ func (c *queryClient) EcallRecords(ctx context.Context, in *QueryEcallRecordsReq return out, nil } +func (c *queryClient) NetworkPubkey(ctx context.Context, in *QueryNetworkPubkeyRequest, opts ...grpc.CallOption) (*QueryNetworkPubkeyResponse, error) { + out := new(QueryNetworkPubkeyResponse) + err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/NetworkPubkey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) EncryptedSeed(ctx context.Context, in *QueryEncryptedSeedRequest, opts ...grpc.CallOption) (*QueryEncryptedSeedResponse, error) { out := new(QueryEncryptedSeedResponse) err := c.cc.Invoke(ctx, "/secret.compute.v1beta1.Query/EncryptedSeed", in, out, opts...) @@ -3186,6 +3339,8 @@ type QueryServer interface { EcallRecord(context.Context, *QueryEcallRecordRequest) (*QueryEcallRecordResponse, error) // Query ecall records for a range of block heights (batch sync) EcallRecords(context.Context, *QueryEcallRecordsRequest) (*QueryEcallRecordsResponse, error) + // Query network pubkey by block height and seed index (for non-SGX node sync) + NetworkPubkey(context.Context, *QueryNetworkPubkeyRequest) (*QueryNetworkPubkeyResponse, error) // Query encrypted seed by certificate hash (for non-SGX node sync) EncryptedSeed(context.Context, *QueryEncryptedSeedRequest) (*QueryEncryptedSeedResponse, error) // Query all execution traces for a block (batch fetch for non-SGX node sync) @@ -3247,6 +3402,9 @@ func (*UnimplementedQueryServer) EcallRecord(ctx context.Context, req *QueryEcal func (*UnimplementedQueryServer) EcallRecords(ctx context.Context, req *QueryEcallRecordsRequest) (*QueryEcallRecordsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EcallRecords not implemented") } +func (*UnimplementedQueryServer) NetworkPubkey(ctx context.Context, req *QueryNetworkPubkeyRequest) (*QueryNetworkPubkeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NetworkPubkey not implemented") +} func (*UnimplementedQueryServer) EncryptedSeed(ctx context.Context, req *QueryEncryptedSeedRequest) (*QueryEncryptedSeedResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EncryptedSeed not implemented") } @@ -3537,6 +3695,24 @@ func _Query_EcallRecords_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Query_NetworkPubkey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryNetworkPubkeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NetworkPubkey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/secret.compute.v1beta1.Query/NetworkPubkey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NetworkPubkey(ctx, req.(*QueryNetworkPubkeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_EncryptedSeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryEncryptedSeedRequest) if err := dec(in); err != nil { @@ -3691,6 +3867,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "EcallRecords", Handler: _Query_EcallRecords_Handler, }, + { + MethodName: "NetworkPubkey", + Handler: _Query_NetworkPubkey_Handler, + }, { MethodName: "EncryptedSeed", Handler: _Query_EncryptedSeed_Handler, @@ -4644,6 +4824,76 @@ func (m *QueryEcallRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *QueryNetworkPubkeyRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryNetworkPubkeyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNetworkPubkeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ISeed != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ISeed)) + i-- + dAtA[i] = 0x10 + } + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryNetworkPubkeyResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryNetworkPubkeyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNetworkPubkeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.IoPubkey) > 0 { + i -= len(m.IoPubkey) + copy(dAtA[i:], m.IoPubkey) + i = encodeVarintQuery(dAtA, i, uint64(len(m.IoPubkey))) + i-- + dAtA[i] = 0x12 + } + if len(m.NodePubkey) > 0 { + i -= len(m.NodePubkey) + copy(dAtA[i:], m.NodePubkey) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NodePubkey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *QueryEcallRecordsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -5701,6 +5951,38 @@ func (m *QueryEcallRecordResponse) Size() (n int) { return n } +func (m *QueryNetworkPubkeyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + if m.ISeed != 0 { + n += 1 + sovQuery(uint64(m.ISeed)) + } + return n +} + +func (m *QueryNetworkPubkeyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NodePubkey) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.IoPubkey) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *QueryEcallRecordsRequest) Size() (n int) { if m == nil { return 0 @@ -8567,6 +8849,212 @@ func (m *QueryEcallRecordResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryNetworkPubkeyRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryNetworkPubkeyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryNetworkPubkeyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ISeed", wireType) + } + m.ISeed = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ISeed |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryNetworkPubkeyResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryNetworkPubkeyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryNetworkPubkeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodePubkey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NodePubkey = append(m.NodePubkey[:0], dAtA[iNdEx:postIndex]...) + if m.NodePubkey == nil { + m.NodePubkey = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IoPubkey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IoPubkey = append(m.IoPubkey[:0], dAtA[iNdEx:postIndex]...) + if m.IoPubkey == nil { + m.IoPubkey = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryEcallRecordsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/compute/internal/types/query.pb.gw.go b/x/compute/internal/types/query.pb.gw.go index fb1e1fc5ed..069cb3df9c 100644 --- a/x/compute/internal/types/query.pb.gw.go +++ b/x/compute/internal/types/query.pb.gw.go @@ -772,6 +772,82 @@ func local_request_Query_EcallRecords_0(ctx context.Context, marshaler runtime.M } +func request_Query_NetworkPubkey_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNetworkPubkeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + val, ok = pathParams["i_seed"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "i_seed") + } + + protoReq.ISeed, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "i_seed", err) + } + + msg, err := client.NetworkPubkey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NetworkPubkey_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNetworkPubkeyRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["height"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "height") + } + + protoReq.Height, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "height", err) + } + + val, ok = pathParams["i_seed"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "i_seed") + } + + protoReq.ISeed, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "i_seed", err) + } + + msg, err := server.NetworkPubkey(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_Query_EncryptedSeed_0 = &utilities.DoubleArray{Encoding: map[string]int{"cert_hash": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -1415,6 +1491,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_NetworkPubkey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_NetworkPubkey_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NetworkPubkey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_EncryptedSeed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1871,6 +1970,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_NetworkPubkey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_NetworkPubkey_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NetworkPubkey_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_EncryptedSeed_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -2005,6 +2124,8 @@ var ( pattern_Query_EcallRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"compute", "v1beta1", "ecalls"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_NetworkPubkey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"compute", "v1beta1", "network_pubkey", "height", "i_seed"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_EncryptedSeed_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "encrypted_seed", "cert_hash"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_BlockTraces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"compute", "v1beta1", "block_traces", "height"}, "", runtime.AssumeColonVerbOpt(false))) @@ -2047,6 +2168,8 @@ var ( forward_Query_EcallRecords_0 = runtime.ForwardResponseMessage + forward_Query_NetworkPubkey_0 = runtime.ForwardResponseMessage + forward_Query_EncryptedSeed_0 = runtime.ForwardResponseMessage forward_Query_BlockTraces_0 = runtime.ForwardResponseMessage diff --git a/x/compute/module.go b/x/compute/module.go index 5b6c9d9ece..c18fb08e4d 100644 --- a/x/compute/module.go +++ b/x/compute/module.go @@ -19,6 +19,7 @@ import ( "github.com/scrtlabs/SecretNetwork/x/compute/client/cli" "github.com/scrtlabs/SecretNetwork/x/compute/internal/keeper" "github.com/scrtlabs/SecretNetwork/x/compute/internal/types" + tmenclave "github.com/scrtlabs/tm-secret-enclave" ) var ( @@ -231,7 +232,6 @@ func (am AppModule) BeginBlock(c context.Context) error { // Don't fail the block for recording errors } } - } am.keeper.SetRandomSeed(ctx, random, validator_set_evidence) } else { From 3bcfa87ba4c4cb493b1839348262b6743f7360da Mon Sep 17 00:00:00 2001 From: cboh4 Date: Tue, 14 Apr 2026 12:01:24 +0300 Subject: [PATCH 27/55] wrap update whitelist --- go-cosmwasm/api/ecall_client_stub.go | 1 + go-cosmwasm/api/lib.go | 11 +++++++++++ go-cosmwasm/api/lib_nosgx.go | 10 ++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/go-cosmwasm/api/ecall_client_stub.go b/go-cosmwasm/api/ecall_client_stub.go index 30a320395e..f1c9e9c8c6 100644 --- a/go-cosmwasm/api/ecall_client_stub.go +++ b/go-cosmwasm/api/ecall_client_stub.go @@ -23,6 +23,7 @@ func (c *EcallClient) FetchBlockCreateResults(int64) ([]*CreateResult, [][]byte, return nil, nil, nil } func (c *EcallClient) FetchNetworkPubkey(int64, uint32) ([]byte, []byte, error) { return nil, nil, nil } +func (c *EcallClient) FetchMachineIDProof(int64, string) ([]byte, error) { return nil, nil } func (c *EcallClient) Close() error { return nil } func (c *EcallClient) SetGrpcAddr(string) error { return nil } func (c *EcallClient) IsConnected() bool { return false } diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index 6f6f144b36..98053cc9a2 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -278,6 +278,17 @@ func OnApproveMachineID(machineID []byte) error { return errors.New("onchain_approve_machine_id failed") } + recorder := GetRecorder() + if recorder.IsSGXMode() { + height := recorder.GetCurrentBlockHeight() + machineIDHex := hex.EncodeToString(machineID) + if recErr := recorder.RecordMachineIDProof(height, []byte(machineIDHex), proof[:]); recErr != nil { + logError("OnApproveMachineID", "Failed to record machine ID proof for replay: %v", recErr) + } else { + logInfo("OnApproveMachineID", "Recorded MachineIDProof for %s at height %d", machineIDHex, height) + } + } + return nil } diff --git a/go-cosmwasm/api/lib_nosgx.go b/go-cosmwasm/api/lib_nosgx.go index e83a761fe8..1b64dce6f5 100644 --- a/go-cosmwasm/api/lib_nosgx.go +++ b/go-cosmwasm/api/lib_nosgx.go @@ -401,6 +401,14 @@ func OnApproveMachineID(machineID []byte, proof *[32]byte, is_on_chain bool) err recorder := GetRecorder() height := recorder.GetCurrentBlockHeight() + machineIDHex := fmt.Sprintf("%x", machineID) + if height == 24727451 && machineIDHex == "07a78d5ff52afbc023a6c0b95a28f2f4048f2d36" { + logInfo("OnApproveMachineID", "Using hardcoded proof to bypass missing SGX record at height 24727451") + hardcodedProof, _ := hex.DecodeString("364580d1787d77a024f852aeb871bcec5114033c30341f09ae1863a3522d2773") + copy(proof[:], hardcodedProof) + return nil + } + // During node init (height=0), keeper loads stored proofs from state. // On SGX nodes this loads them into the enclave; on non-SGX there's // no enclave, so just skip — the proof already lives in the KV store. @@ -409,8 +417,6 @@ func OnApproveMachineID(machineID []byte, proof *[32]byte, is_on_chain bool) err return nil } - machineIDHex := fmt.Sprintf("%x", machineID) - // Non-SGX nodes always fetch from the SGX node via gRPC client := GetEcallClient() retryDelay := 2 * time.Second From 4ccf873595040ccea8ecf63b8aa91dcba4382512 Mon Sep 17 00:00:00 2001 From: cboh4 Date: Tue, 12 May 2026 17:12:31 +0300 Subject: [PATCH 28/55] refactor: lower log levels in msg_dispatcher --- go-cosmwasm/api/ecall_record.go | 74 ++++++++++++++++----- go-cosmwasm/api/lib_nosgx.go | 6 -- x/compute/internal/keeper/keeper.go | 2 +- x/compute/internal/keeper/msg_dispatcher.go | 6 +- 4 files changed, 63 insertions(+), 25 deletions(-) diff --git a/go-cosmwasm/api/ecall_record.go b/go-cosmwasm/api/ecall_record.go index 3f00a934e0..f931de10b7 100644 --- a/go-cosmwasm/api/ecall_record.go +++ b/go-cosmwasm/api/ecall_record.go @@ -8,6 +8,7 @@ import ( "fmt" "os" "path/filepath" + "strconv" "sync" "sync/atomic" @@ -31,6 +32,10 @@ type EcallRecorder struct { mode NodeMode db dbm.DB + // Config + retentionBlocks int64 + pruneInterval int64 + // Block-scoped execution tracking currentBlockHeight int64 executionIndex int64 @@ -104,10 +109,30 @@ func GetRecorder() *EcallRecorder { // Check if storing SGX data is enabled (from config or env var) storeSGXData := os.Getenv("SECRET_STORE_SGX_DATA") == "true" + // Get retention settings + retentionBlocks := DefaultRetentionBlocks + if v := os.Getenv("SECRET_SGX_DATA_RETENTION_BLOCKS"); v != "" { + if parsed, err := strconv.ParseInt(v, 10, 64); err == nil && parsed > 0 { + retentionBlocks = parsed + } + } + + pruneInterval := PruneIntervalBlocks + if v := os.Getenv("SECRET_SGX_DATA_PRUNE_INTERVAL"); v != "" { + if parsed, err := strconv.ParseInt(v, 10, 64); err == nil && parsed > 0 { + pruneInterval = parsed + } + } + // If already initialized, check if we need to upgrade the recording state if globalRecorder != nil { hasDB := globalRecorder.db != nil if mode == NodeModeReplay || storeSGXData == hasDB { + // Update config dynamically if re-initialized + globalRecorder.mu.Lock() + globalRecorder.retentionBlocks = retentionBlocks + globalRecorder.pruneInterval = pruneInterval + globalRecorder.mu.Unlock() return globalRecorder } // Transitioning states (tempApp didn't have flag, but real app does) @@ -118,9 +143,11 @@ func GetRecorder() *EcallRecorder { if mode == NodeModeReplay || (mode == NodeModeSGX && !storeSGXData) { globalRecorder = &EcallRecorder{ - mode: mode, - db: nil, - blockTraces: make(map[int64]*ExecutionTrace), + mode: mode, + db: nil, + retentionBlocks: retentionBlocks, + pruneInterval: pruneInterval, + blockTraces: make(map[int64]*ExecutionTrace), } if mode == NodeModeReplay { logInfo("EcallRecorder", "Initialized in replay mode (no local DB, fetches from remote)") @@ -154,17 +181,21 @@ func GetRecorder() *EcallRecorder { logError("EcallRecorder", "Error opening database: %v", err) // Create a nil recorder that will skip recording globalRecorder = &EcallRecorder{ - mode: mode, - db: nil, - blockTraces: make(map[int64]*ExecutionTrace), + mode: mode, + db: nil, + retentionBlocks: retentionBlocks, + pruneInterval: pruneInterval, + blockTraces: make(map[int64]*ExecutionTrace), } return globalRecorder } globalRecorder = &EcallRecorder{ - mode: mode, - db: db, - blockTraces: make(map[int64]*ExecutionTrace), + mode: mode, + db: db, + retentionBlocks: retentionBlocks, + pruneInterval: pruneInterval, + blockTraces: make(map[int64]*ExecutionTrace), } if storeSGXData { @@ -775,8 +806,16 @@ func (r *EcallRecorder) DeleteRecordsBeforeHeight(height int64) error { count := 0 - // Prune all height-keyed prefixes: block signatures, seeds, seed errors - for _, prefix := range [][]byte{prefixSubmitBlockSignatures, prefixGetEncryptedSeed, prefixGetEncryptedSeedErr} { + // Prune all height-keyed prefixes + for _, prefix := range [][]byte{ + prefixSubmitBlockSignatures, + prefixGetEncryptedSeed, + prefixGetEncryptedSeedErr, + prefixExecutionTrace, + prefixMachineIDProof, + prefixCreateResult, + prefixGetNetworkPubkey, + } { startKey := makeBlockKey(prefix, 0) endKey := makeBlockKey(prefix, height) @@ -805,20 +844,25 @@ func (r *EcallRecorder) DeleteRecordsBeforeHeight(height int64) error { return nil } -// PruneOldRecords runs pruning if conditions are met (every PruneIntervalBlocks) +// PruneOldRecords runs pruning if conditions are met (every pruneInterval) func (r *EcallRecorder) PruneOldRecords(currentHeight int64) { // Only prune in SGX mode (non-replay) if r.IsReplayMode() { return } - // Only prune every PruneIntervalBlocks - if currentHeight%PruneIntervalBlocks != 0 { + r.mu.RLock() + interval := r.pruneInterval + retention := r.retentionBlocks + r.mu.RUnlock() + + // Only prune every pruneInterval + if interval <= 0 || currentHeight%interval != 0 { return } // Calculate cutoff height - cutoffHeight := currentHeight - DefaultRetentionBlocks + cutoffHeight := currentHeight - retention if cutoffHeight <= 0 { return } diff --git a/go-cosmwasm/api/lib_nosgx.go b/go-cosmwasm/api/lib_nosgx.go index 1b64dce6f5..9e19d91490 100644 --- a/go-cosmwasm/api/lib_nosgx.go +++ b/go-cosmwasm/api/lib_nosgx.go @@ -402,12 +402,6 @@ func OnApproveMachineID(machineID []byte, proof *[32]byte, is_on_chain bool) err height := recorder.GetCurrentBlockHeight() machineIDHex := fmt.Sprintf("%x", machineID) - if height == 24727451 && machineIDHex == "07a78d5ff52afbc023a6c0b95a28f2f4048f2d36" { - logInfo("OnApproveMachineID", "Using hardcoded proof to bypass missing SGX record at height 24727451") - hardcodedProof, _ := hex.DecodeString("364580d1787d77a024f852aeb871bcec5114033c30341f09ae1863a3522d2773") - copy(proof[:], hardcodedProof) - return nil - } // During node init (height=0), keeper loads stored proofs from state. // On SGX nodes this loads them into the enclave; on non-SGX there's diff --git a/x/compute/internal/keeper/keeper.go b/x/compute/internal/keeper/keeper.go index 0abb6dbd43..1ac4471a00 100644 --- a/x/compute/internal/keeper/keeper.go +++ b/x/compute/internal/keeper/keeper.go @@ -1512,7 +1512,7 @@ func (k *Keeper) handleContractResponse( // This is used mainly in replies in order to decrypt their data. ogSigInfo wasmTypes.SigInfo, ) ([]byte, error) { - ctx.Logger().Info(fmt.Sprintf("[handleContractResponse] height=%d contract=%s numSubMsgs=%d numLogs=%d numEvents=%d dataLen=%d gasConsumed=%d", + ctx.Logger().Debug(fmt.Sprintf("[handleContractResponse] height=%d contract=%s numSubMsgs=%d numLogs=%d numEvents=%d dataLen=%d gasConsumed=%d", ctx.BlockHeight(), contractAddr.String(), len(msgs), len(logs), len(evts), len(data), ctx.GasMeter().GasConsumed())) events := types.ContractLogsToSdkEvents(logs, contractAddr) diff --git a/x/compute/internal/keeper/msg_dispatcher.go b/x/compute/internal/keeper/msg_dispatcher.go index 22c2e2b13e..48f41cbe89 100644 --- a/x/compute/internal/keeper/msg_dispatcher.go +++ b/x/compute/internal/keeper/msg_dispatcher.go @@ -246,7 +246,7 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk } else if msg.Msg.Stargate != nil { msgType = "stargate" } - ctx.Logger().Info(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] id=%s type=%s replyOn=%s gasLimit=%v detail=%s gasBefore=%d", + ctx.Logger().Debug(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] id=%s type=%s replyOn=%s gasLimit=%v detail=%s gasBefore=%d", ctx.BlockHeight(), i, string(msg.ID), msgType, msg.ReplyOn, msg.GasLimit, msgDetail, ctx.GasMeter().GasConsumed())) if d.keeper.GetLastMsgMarkerContainer().GetMarker() { @@ -291,10 +291,10 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk totalDataLen += len(d) } if err != nil { - ctx.Logger().Info(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] FAILED: %v gasAfter=%d", + ctx.Logger().Debug(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] FAILED: %v gasAfter=%d", ctx.BlockHeight(), i, err, ctx.GasMeter().GasConsumed())) } else { - ctx.Logger().Info(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] SUCCESS: events=%d dataChunks=%d totalDataLen=%d gasAfter=%d", + ctx.Logger().Debug(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] SUCCESS: events=%d dataChunks=%d totalDataLen=%d gasAfter=%d", ctx.BlockHeight(), i, len(events), len(data), totalDataLen, ctx.GasMeter().GasConsumed())) } From 3be55ff938a987bee9c77a116b1f45e64f770a19 Mon Sep 17 00:00:00 2001 From: cboh4 Date: Tue, 12 May 2026 18:17:09 +0300 Subject: [PATCH 29/55] update querier logic --- x/compute/internal/keeper/querier.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/x/compute/internal/keeper/querier.go b/x/compute/internal/keeper/querier.go index 04cc223a01..1a7286fcf3 100644 --- a/x/compute/internal/keeper/querier.go +++ b/x/compute/internal/keeper/querier.go @@ -440,14 +440,8 @@ func (q GrpcQuerier) MachineIDProof(c context.Context, req *types.QueryMachineID return nil, status.Error(codes.InvalidArgument, "machine_id is required") } - // Decode hex string to bytes - machineID, err := hex.DecodeString(req.MachineId) - if err != nil { - return nil, status.Error(codes.InvalidArgument, "invalid machine_id: must be hex encoded") - } - recorder := api.GetRecorder() - proof, found := recorder.ReplayMachineIDProof(req.Height, machineID) + proof, found := recorder.ReplayMachineIDProof(req.Height, []byte(req.MachineId)) if !found { return nil, status.Errorf(codes.NotFound, "no machine ID proof found for height %d", req.Height) } From 460429258f3cf68439c0d3e223eff95c89f48db1 Mon Sep 17 00:00:00 2001 From: cboh4 Date: Wed, 13 May 2026 15:06:28 +0300 Subject: [PATCH 30/55] update go.mod --- go.mod | 12 ++++++------ go.sum | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index f1709447d3..0dc417002f 100644 --- a/go.mod +++ b/go.mod @@ -8,8 +8,8 @@ replace ( cosmossdk.io/api => github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 cosmossdk.io/store => github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 cosmossdk.io/x/tx => github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 - github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.19-secret.11-non-sgx - github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.10 + github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.23-secret.1 + github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12 github.com/cosmos/iavl => github.com/scrtlabs/iavl v1.2.2-secret.0 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 @@ -175,13 +175,13 @@ require ( github.com/klauspost/compress v1.17.11 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/lib/pq v1.10.9 // indirect + github.com/lib/pq v1.12.0 // indirect github.com/linxGnu/grocksdb v1.8.14 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/minio/highwayhash v1.0.3 // indirect + github.com/minio/highwayhash v1.0.4 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -190,7 +190,7 @@ require ( github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect - github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect + github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.21.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect @@ -201,7 +201,7 @@ require ( github.com/rs/cors v1.11.1 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/sasha-s/go-deadlock v0.3.5 // indirect + github.com/sasha-s/go-deadlock v0.3.9 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect diff --git a/go.sum b/go.sum index ef578177eb..05d26a0c15 100644 --- a/go.sum +++ b/go.sum @@ -1399,8 +1399,8 @@ github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+ github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= -github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.12.0 h1:mC1zeiNamwKBecjHarAr26c/+d8V5w/u4J0I/yASbJo= +github.com/lib/pq v1.12.0/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= @@ -1435,8 +1435,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= -github.com/minio/highwayhash v1.0.3 h1:kbnuUMoHYyVl7szWjSxJnxw11k2U709jqFPPmIUyD6Q= -github.com/minio/highwayhash v1.0.3/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= +github.com/minio/highwayhash v1.0.4 h1:asJizugGgchQod2ja9NJlGOWq4s7KsAWr5XUc9Clgl4= +github.com/minio/highwayhash v1.0.4/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ= github.com/miscreant/miscreant.go v0.0.0-20200214223636-26d376326b75 h1:cUVxyR+UfmdEAZGJ8IiKld1O0dbGotEnkMolG5hfMSY= github.com/miscreant/miscreant.go v0.0.0-20200214223636-26d376326b75/go.mod h1:pBbZyGwC5i16IBkjVKoy/sznA8jPD/K9iedwe1ESE6w= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= @@ -1521,8 +1521,8 @@ github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtP github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw3fD4oEoeorXc6saIiQ23LrGLth0Gw= -github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe h1:vHpqOnPlnkba8iSxU4j/CvDSS9J4+F4473esQsYLGoE= +github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= @@ -1607,10 +1607,10 @@ github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgY github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= -github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.10 h1:MJgXkosWs87TCy76l0cbxDUL4/7xlO1fKdFYPGKUkYM= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.10/go.mod h1:czzdPa3SiwDgWM0QqTZLKgwaF9k5w3rMS1kJzHIoGbQ= +github.com/sasha-s/go-deadlock v0.3.9 h1:fiaT9rB7g5sr5ddNZvlwheclN9IP86eFW9WgqlEQV+w= +github.com/sasha-s/go-deadlock v0.3.9/go.mod h1:KuZj51ZFmx42q/mPaYbRk0P1xcwe697zsJKE03vD4/Y= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12 h1:PWRZGsDaEVGkBleaoKwCcKdFejRFEV3F+P15P/ux0BQ= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12/go.mod h1:oAqAIxM6W1HXLs/Id+58e5tTdtm5OE35AFj+UsgTtGk= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 h1:9IGLySVhC2qSrxT3fZvvqwjKsnXWSSKnywQDzT8y1Gs= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 h1:TELtwBkSg0xBrs2ObFE0pVVWF6E31fPCDX2tk8OiJPo= @@ -1619,8 +1619,8 @@ github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 h1:i3k5706sDHKhaCvzokB+n33/ github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= github.com/scrtlabs/iavl v1.2.2-secret.0 h1:P96PL1Lf8OBSW9pMrlaRxhceZ4z9Hc7jk12g9ShWeHw= github.com/scrtlabs/iavl v1.2.2-secret.0/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/scrtlabs/tendermint v0.38.19-secret.11-non-sgx h1:FuTQ+cuMxb6YD+0RDfWEJ89pATv7gvn9YqTu5sguz9s= -github.com/scrtlabs/tendermint v0.38.19-secret.11-non-sgx/go.mod h1:I8kyAQPjMco6jjCshUSMYFoY6TybsbADGBmGcjWrgKM= +github.com/scrtlabs/tendermint v0.38.23-secret.1 h1:Fj3F3mC4P7YuRhT71OnKbVQNFl9smndqo9h3tUoJwKE= +github.com/scrtlabs/tendermint v0.38.23-secret.1/go.mod h1:HHgYHxYnGRCJIqihEbfO+icKitZUiYOKE529pQRIEu4= github.com/scrtlabs/tm-secret-enclave v1.13.1 h1:0mXcBdoWyqEGhQEdbXMjSuTi9LKKMld2BqEj0eNpoxU= github.com/scrtlabs/tm-secret-enclave v1.13.1/go.mod h1:nxZQtzzAqBNBLOEXSv4cKlUnVA4vRmHOn6ujr3kxVME= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= From d8541de381494df3dad49e7f69825d8ed1d5fc9e Mon Sep 17 00:00:00 2001 From: cboh4 Date: Wed, 13 May 2026 15:12:05 +0300 Subject: [PATCH 31/55] remove debug printfs --- app/app.go | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/app/app.go b/app/app.go index dd98633ce8..6331bb802e 100644 --- a/app/app.go +++ b/app/app.go @@ -3,10 +3,8 @@ package app import ( "bytes" "encoding/base64" - "fmt" "io" "net/http" - "os" "path/filepath" "syscall" @@ -528,23 +526,7 @@ func (app *SecretNetworkApp) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalize // EndBlocker application updates every end block func (app *SecretNetworkApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { - resp, err := app.mm.EndBlock(ctx) - - // DUMP STATE FOR DIVERGENT BLOCK - if ctx.BlockHeight() == 24066603 { - fmt.Printf("\n==== INTERCEPTED ENDBLOCK AT 24066603 ====\n") - // Dump ALL events accumulated in the block - eventsJSON, _ := tmjson.MarshalIndent(ctx.EventManager().Events(), "", " ") - - errWrite := os.WriteFile("divergent_events_24066603.json", eventsJSON, 0o644) - if errWrite != nil { - fmt.Printf("Failed to write events to file: %v\n", errWrite) - } else { - fmt.Printf("Wrote divergent EndBlock events to divergent_events_24066603.json\n") - } - } - - return resp, err + return app.mm.EndBlock(ctx) } // InitChainer application update at chain initialization From 086d77e869c1a80a143ddb9ef314182632e83d42 Mon Sep 17 00:00:00 2001 From: cboh4 Date: Thu, 7 May 2026 01:01:38 +0300 Subject: [PATCH 32/55] feat: update hardcoded contract admins and add derivative_hooks contract --- .../contract-engine/src/hardcoded_admins.rs | 1 + x/compute/internal/keeper/hardcoded_admins.go | 1 + x/compute/internal/keeper/migrations.go | 36 +++++++++++++++++++ x/compute/module.go | 7 +++- 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/cosmwasm/enclaves/shared/contract-engine/src/hardcoded_admins.rs b/cosmwasm/enclaves/shared/contract-engine/src/hardcoded_admins.rs index 6dfc7263f5..3d9a6a44c5 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/hardcoded_admins.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/hardcoded_admins.rs @@ -581,6 +581,7 @@ lazy_static::lazy_static! { ("secret16snu3lt8k9u0xr54j2hqyhvwnx9my7kq7ay8lp", "secret1hxrvx0v0zvqgmpuzspdg5j8rrxpjgyjql3w9gh"), // ERTH ("secret14p6dhjznntlzw0yysl7p6z069nk0skv5e9qjut", "secret1hxrvx0v0zvqgmpuzspdg5j8rrxpjgyjql3w9gh"), // ANML ("secret1yrzp33hvkwd3dr5farjgwdutecrhd0r7uhqksq", "secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03"), // testnet contract + ("secret1r2vzslwkad9vcg06hgy4km9zh4jvawxtc2hl98", "secret16cx295surhm7ps60jsfwernx4kxa4gf8z7yxvd"), // derivative_hooks ]); /// The entire history of contracts that were deployed before v1.10 and have been migrated using the hardcoded admin feature. diff --git a/x/compute/internal/keeper/hardcoded_admins.go b/x/compute/internal/keeper/hardcoded_admins.go index 34792ca193..97c3fa8c4f 100644 --- a/x/compute/internal/keeper/hardcoded_admins.go +++ b/x/compute/internal/keeper/hardcoded_admins.go @@ -579,4 +579,5 @@ var hardcodedContractAdmins = map[string]string{ "secret16snu3lt8k9u0xr54j2hqyhvwnx9my7kq7ay8lp": "secret1hxrvx0v0zvqgmpuzspdg5j8rrxpjgyjql3w9gh", "secret14p6dhjznntlzw0yysl7p6z069nk0skv5e9qjut": "secret1hxrvx0v0zvqgmpuzspdg5j8rrxpjgyjql3w9gh", "secret1yrzp33hvkwd3dr5farjgwdutecrhd0r7uhqksq": "secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03", + "secret1r2vzslwkad9vcg06hgy4km9zh4jvawxtc2hl98": "secret16cx295surhm7ps60jsfwernx4kxa4gf8z7yxvd", // derivative_hooks } diff --git a/x/compute/internal/keeper/migrations.go b/x/compute/internal/keeper/migrations.go index 9e2a4b31f8..0780d6ca56 100644 --- a/x/compute/internal/keeper/migrations.go +++ b/x/compute/internal/keeper/migrations.go @@ -213,6 +213,42 @@ func (m Migrator) Migrate7to8(ctx sdk.Context) error { return nil } +// Migrate8to9 migrates from version 8 to 9. The migration includes setting the admin for any newly added hardcoded contracts +func (m Migrator) Migrate8to9(ctx sdk.Context) error { + store := prefix.NewStore(runtime.KVStoreAdapter(m.keeper.storeService.OpenKVStore(ctx)), types.ContractKeyPrefix) + + // Iterate only over the hardcoded list + for contractAddrStr, newAdmin := range hardcodedContractAdmins { + if newAdmin == "" { + continue + } + + contractAddress, err := sdk.AccAddressFromBech32(contractAddrStr) + if err != nil { + ctx.Logger().Error("Migrate8to9: invalid contract address in hardcoded admins", "contract", contractAddrStr, "error", err) + continue + } + + bz := store.Get(contractAddress) + if bz != nil { + var contractInfo types.ContractInfo + m.keeper.cdc.MustUnmarshal(bz, &contractInfo) + + if newAdmin != contractInfo.Admin { + contractInfo.Admin = newAdmin + contractInfo.AdminProof = make([]byte, 32) // Dummy proof, ignored by enclave + + updatedBz := m.keeper.cdc.MustMarshal(&contractInfo) + store.Set(contractAddress, updatedBz) + + ctx.Logger().Info("Migrate8to9: successfully migrated admin for contract", "contract", contractAddrStr, "new_admin", newAdmin) + } + } + } + + return nil +} + const progressPartSize = 1000 func logMigrationProgress(ctx sdk.Context, formatter *message.Printer, migratedContracts uint64, totalContracts uint64, previousTime int64) { diff --git a/x/compute/module.go b/x/compute/module.go index c18fb08e4d..b27f9c5d1b 100644 --- a/x/compute/module.go +++ b/x/compute/module.go @@ -95,7 +95,7 @@ func NewAppModule(keeper Keeper) AppModule { } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 8 } +func (AppModule) ConsensusVersion() uint64 { return 9 } func (am AppModule) RegisterServices(configurator module.Configurator) { types.RegisterMsgServer(configurator.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) @@ -134,6 +134,11 @@ func (am AppModule) RegisterServices(configurator module.Configurator) { if err != nil { panic(err) } + + err = configurator.RegisterMigration(types.ModuleName, 8, m.Migrate8to9) + if err != nil { + panic(err) + } } // InitGenesis performs genesis initialization for the compute module. It returns From 392ee128069d21e8186b5c2e0c945093f5bbddc5 Mon Sep 17 00:00:00 2001 From: cboh4 Date: Thu, 7 May 2026 08:22:11 +0300 Subject: [PATCH 33/55] add testnet contract --- .../enclaves/shared/contract-engine/src/hardcoded_admins.rs | 2 +- x/compute/internal/keeper/hardcoded_admins.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cosmwasm/enclaves/shared/contract-engine/src/hardcoded_admins.rs b/cosmwasm/enclaves/shared/contract-engine/src/hardcoded_admins.rs index 3d9a6a44c5..8ca5f16c14 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/hardcoded_admins.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/hardcoded_admins.rs @@ -5,7 +5,7 @@ use std::collections::HashMap; lazy_static::lazy_static! { /// Current hardcoded contract admins static ref HARDCODED_CONTRACT_ADMINS: HashMap<&'static str, &'static str> = HashMap::from([ - ("secret1hg83qtpn0444k7shhmuawhykklycd7qt24z34g", "secret1f2jrcqsx7glyta39c6tum2lhk5kh2a0ty6r9ms"), // snip20 testnet contract + ("secret1vuq7hw2qp5trqyp4vzm6axpg4jrw6vc03uzgrp", "secret1pcegd258whwdynv76xtudwhshq3dv73rwjx5jf"), // snip20 testnet contract ("secret1jr05klxup5285wv2w24x3rs6rr37c8fyz39evd", "secret1f2jrcqsx7glyta39c6tum2lhk5kh2a0ty6r9ms"), // snip20 testnet contract ("secret1my2ycry070nsgugw67k4ej93ttsgut5yd8xnhj", "secret1f2jrcqsx7glyta39c6tum2lhk5kh2a0ty6r9ms"), // snip20 testnet contract ("secret1rekrj69d9kl7p5gpcq7d0qrwdrw0hmszrv5hy3", "secret1f2jrcqsx7glyta39c6tum2lhk5kh2a0ty6r9ms"), // snip20 testnet contract diff --git a/x/compute/internal/keeper/hardcoded_admins.go b/x/compute/internal/keeper/hardcoded_admins.go index 97c3fa8c4f..f3272df3a9 100644 --- a/x/compute/internal/keeper/hardcoded_admins.go +++ b/x/compute/internal/keeper/hardcoded_admins.go @@ -3,7 +3,7 @@ package keeper // This map enables these gov-proposed contracts to have admin functionality even though they // were created before the contract upgrade feature existed var hardcodedContractAdmins = map[string]string{ - "secret1hg83qtpn0444k7shhmuawhykklycd7qt24z34g": "secret1f2jrcqsx7glyta39c6tum2lhk5kh2a0ty6r9ms", // snip20 testnet contract + "secret1vuq7hw2qp5trqyp4vzm6axpg4jrw6vc03uzgrp": "secret1pcegd258whwdynv76xtudwhshq3dv73rwjx5jf", // snip20 testnet contract "secret1jr05klxup5285wv2w24x3rs6rr37c8fyz39evd": "secret1f2jrcqsx7glyta39c6tum2lhk5kh2a0ty6r9ms", // snip20 testnet contract "secret1my2ycry070nsgugw67k4ej93ttsgut5yd8xnhj": "secret1f2jrcqsx7glyta39c6tum2lhk5kh2a0ty6r9ms", // snip20 testnet contract "secret1rekrj69d9kl7p5gpcq7d0qrwdrw0hmszrv5hy3": "secret1f2jrcqsx7glyta39c6tum2lhk5kh2a0ty6r9ms", // snip20 testnet contract From 876fb40493c97739b0578b57069e89acddcebe25 Mon Sep 17 00:00:00 2001 From: cboh4 Date: Sat, 9 May 2026 15:34:50 +0300 Subject: [PATCH 34/55] update go.mod --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 0dc417002f..97f04cda68 100644 --- a/go.mod +++ b/go.mod @@ -8,8 +8,8 @@ replace ( cosmossdk.io/api => github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 cosmossdk.io/store => github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 cosmossdk.io/x/tx => github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 - github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.23-secret.1 - github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12 + github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.23-secret.0 + github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.11 github.com/cosmos/iavl => github.com/scrtlabs/iavl v1.2.2-secret.0 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 diff --git a/go.sum b/go.sum index 05d26a0c15..2d0e21dccf 100644 --- a/go.sum +++ b/go.sum @@ -1609,8 +1609,8 @@ github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWR github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.9 h1:fiaT9rB7g5sr5ddNZvlwheclN9IP86eFW9WgqlEQV+w= github.com/sasha-s/go-deadlock v0.3.9/go.mod h1:KuZj51ZFmx42q/mPaYbRk0P1xcwe697zsJKE03vD4/Y= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12 h1:PWRZGsDaEVGkBleaoKwCcKdFejRFEV3F+P15P/ux0BQ= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12/go.mod h1:oAqAIxM6W1HXLs/Id+58e5tTdtm5OE35AFj+UsgTtGk= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.11 h1:Yl1x19k6jIFXPDX/Rrj1p4z7EsQDVhNJt0gX1/JuJsM= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.11/go.mod h1:b7GmzR/8Ic9g6Aswsm3ryLhE5dhgbKTJ6o78mhxjRO4= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 h1:9IGLySVhC2qSrxT3fZvvqwjKsnXWSSKnywQDzT8y1Gs= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 h1:TELtwBkSg0xBrs2ObFE0pVVWF6E31fPCDX2tk8OiJPo= @@ -1619,8 +1619,8 @@ github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 h1:i3k5706sDHKhaCvzokB+n33/ github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= github.com/scrtlabs/iavl v1.2.2-secret.0 h1:P96PL1Lf8OBSW9pMrlaRxhceZ4z9Hc7jk12g9ShWeHw= github.com/scrtlabs/iavl v1.2.2-secret.0/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/scrtlabs/tendermint v0.38.23-secret.1 h1:Fj3F3mC4P7YuRhT71OnKbVQNFl9smndqo9h3tUoJwKE= -github.com/scrtlabs/tendermint v0.38.23-secret.1/go.mod h1:HHgYHxYnGRCJIqihEbfO+icKitZUiYOKE529pQRIEu4= +github.com/scrtlabs/tendermint v0.38.23-secret.0 h1:nPt77SkQILJR6skCIZJclcTtjnHeU6wrqzvVqg3hAps= +github.com/scrtlabs/tendermint v0.38.23-secret.0/go.mod h1:HHgYHxYnGRCJIqihEbfO+icKitZUiYOKE529pQRIEu4= github.com/scrtlabs/tm-secret-enclave v1.13.1 h1:0mXcBdoWyqEGhQEdbXMjSuTi9LKKMld2BqEj0eNpoxU= github.com/scrtlabs/tm-secret-enclave v1.13.1/go.mod h1:nxZQtzzAqBNBLOEXSv4cKlUnVA4vRmHOn6ujr3kxVME= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= From 07477370d71a8d9cf0834cd7f6cfa3c19193f2e8 Mon Sep 17 00:00:00 2001 From: cboh4 Date: Wed, 13 May 2026 15:43:48 +0300 Subject: [PATCH 35/55] update go.mod --- go.mod | 4 ++-- go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 97f04cda68..0dc417002f 100644 --- a/go.mod +++ b/go.mod @@ -8,8 +8,8 @@ replace ( cosmossdk.io/api => github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 cosmossdk.io/store => github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 cosmossdk.io/x/tx => github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 - github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.23-secret.0 - github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.11 + github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.23-secret.1 + github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12 github.com/cosmos/iavl => github.com/scrtlabs/iavl v1.2.2-secret.0 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 diff --git a/go.sum b/go.sum index 2d0e21dccf..afb5b1ea08 100644 --- a/go.sum +++ b/go.sum @@ -1619,8 +1619,8 @@ github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0 h1:i3k5706sDHKhaCvzokB+n33/ github.com/scrtlabs/cosmos-sdk-x-tx v0.13.7-secret.0/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= github.com/scrtlabs/iavl v1.2.2-secret.0 h1:P96PL1Lf8OBSW9pMrlaRxhceZ4z9Hc7jk12g9ShWeHw= github.com/scrtlabs/iavl v1.2.2-secret.0/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/scrtlabs/tendermint v0.38.23-secret.0 h1:nPt77SkQILJR6skCIZJclcTtjnHeU6wrqzvVqg3hAps= -github.com/scrtlabs/tendermint v0.38.23-secret.0/go.mod h1:HHgYHxYnGRCJIqihEbfO+icKitZUiYOKE529pQRIEu4= +github.com/scrtlabs/tendermint v0.38.23-secret.1 h1:Fj3F3mC4P7YuRhT71OnKbVQNFl9smndqo9h3tUoJwKE= +github.com/scrtlabs/tendermint v0.38.23-secret.1/go.mod h1:HHgYHxYnGRCJIqihEbfO+icKitZUiYOKE529pQRIEu4= github.com/scrtlabs/tm-secret-enclave v1.13.1 h1:0mXcBdoWyqEGhQEdbXMjSuTi9LKKMld2BqEj0eNpoxU= github.com/scrtlabs/tm-secret-enclave v1.13.1/go.mod h1:nxZQtzzAqBNBLOEXSv4cKlUnVA4vRmHOn6ujr3kxVME= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= From 01aede719a490f80ffc5109f302a366aa41e4c82 Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 14 May 2026 14:42:35 +0000 Subject: [PATCH 36/55] Build fix (WIP) --- app/app.go | 2 + client/docs/static/swagger/swagger.yaml | 3 + go-cosmwasm/api/ecall_client.go | 9 +- go-cosmwasm/api/ecall_client_stub.go | 8 +- go-cosmwasm/api/ecall_record.go | 33 +- go-cosmwasm/api/ecall_record_stub.go | 6 +- go-cosmwasm/api/lib.go | 32 +- go-cosmwasm/api/lib_nosgx.go | 33 +- proto/secret/compute/v1beta1/query.proto | 2 + x/compute/internal/keeper/querier.go | 7 +- x/compute/internal/types/query.pb.go | 419 +++++++++++++---------- 11 files changed, 330 insertions(+), 224 deletions(-) diff --git a/app/app.go b/app/app.go index 6331bb802e..d2ff3a58fa 100644 --- a/app/app.go +++ b/app/app.go @@ -3,8 +3,10 @@ package app import ( "bytes" "encoding/base64" + "fmt" "io" "net/http" + "os" "path/filepath" "syscall" diff --git a/client/docs/static/swagger/swagger.yaml b/client/docs/static/swagger/swagger.yaml index d351e1f597..6767983a35 100644 --- a/client/docs/static/swagger/swagger.yaml +++ b/client/docs/static/swagger/swagger.yaml @@ -66537,3 +66537,6 @@ definitions: encrypted_seed: type: string format: byte + machine_binding: + type: string + format: byte diff --git a/go-cosmwasm/api/ecall_client.go b/go-cosmwasm/api/ecall_client.go index bc1c46a34b..878ed11f38 100644 --- a/go-cosmwasm/api/ecall_client.go +++ b/go-cosmwasm/api/ecall_client.go @@ -86,7 +86,8 @@ func (m *QueryEncryptedSeedRequest) ProtoMessage() {} // QueryEncryptedSeedResponse matches QueryEncryptedSeedResponse proto type QueryEncryptedSeedResponse struct { - EncryptedSeed []byte `protobuf:"bytes,1,opt,name=encrypted_seed,json=encryptedSeed,proto3" json:"encrypted_seed,omitempty"` + EncryptedSeed []byte `protobuf:"bytes,1,opt,name=encrypted_seed,json=encryptedSeed,proto3" json:"encrypted_seed,omitempty"` + MachineBinding []byte `protobuf:"bytes,1,opt,name=machine_binding,json=machineBinding,proto3" json:"machine_binding,omitempty"` } func (m *QueryEncryptedSeedResponse) Reset() { *m = QueryEncryptedSeedResponse{} } @@ -536,16 +537,16 @@ func (c *EcallClient) FetchEcallRecord(height int64) (*EcallRecordData, error) { } // FetchEncryptedSeed fetches encrypted seed data from a random SGX node -func (c *EcallClient) FetchEncryptedSeed(height int64, certHashHex string) ([]byte, error) { +func (c *EcallClient) FetchEncryptedSeed(height int64, certHashHex string) ([]byte, []byte, error) { req := &QueryEncryptedSeedRequest{CertHash: certHashHex, Height: height} resp := &QueryEncryptedSeedResponse{} if err := c.invokeWithRetry(methodEncryptedSeed, req, resp); err != nil { - return nil, err // Return raw error to preserve gRPC status codes + return nil, nil, err // Return raw error to preserve gRPC status codes } logInfo("EcallClient", "Fetched encrypted seed (%d bytes) at height %d", len(resp.EncryptedSeed), height) - return resp.EncryptedSeed, nil + return resp.EncryptedSeed, resp.MachineBinding, nil } // FetchMachineIDProof fetches a machine ID proof for a given height and machine ID from a random SGX node diff --git a/go-cosmwasm/api/ecall_client_stub.go b/go-cosmwasm/api/ecall_client_stub.go index f1c9e9c8c6..e0b09c4f78 100644 --- a/go-cosmwasm/api/ecall_client_stub.go +++ b/go-cosmwasm/api/ecall_client_stub.go @@ -15,10 +15,10 @@ type EcallRecordData struct { ValidatorSetEvidence []byte } -func GetEcallClient() *EcallClient { return nil } -func (c *EcallClient) FetchEcallRecord(int64) (*EcallRecordData, error) { return nil, nil } -func (c *EcallClient) FetchEncryptedSeed(int64, string) ([]byte, error) { return nil, nil } -func (c *EcallClient) FetchBlockTraces(int64) ([]*ExecutionTrace, error) { return nil, nil } +func GetEcallClient() *EcallClient { return nil } +func (c *EcallClient) FetchEcallRecord(int64) (*EcallRecordData, error) { return nil, nil } +func (c *EcallClient) FetchEncryptedSeed(int64, string) ([]byte, []byte, error) { return nil, nil, nil } +func (c *EcallClient) FetchBlockTraces(int64) ([]*ExecutionTrace, error) { return nil, nil } func (c *EcallClient) FetchBlockCreateResults(int64) ([]*CreateResult, [][]byte, error) { return nil, nil, nil } diff --git a/go-cosmwasm/api/ecall_record.go b/go-cosmwasm/api/ecall_record.go index f931de10b7..ca804a0e62 100644 --- a/go-cosmwasm/api/ecall_record.go +++ b/go-cosmwasm/api/ecall_record.go @@ -500,7 +500,7 @@ func makeSeedErrKey(height int64, certHash []byte) []byte { // RecordGetEncryptedSeed records the GetEncryptedSeed ecall output (success case) // Key format: prefix(1) | height(8) | certHash -func (r *EcallRecorder) RecordGetEncryptedSeed(height int64, certHash []byte, output []byte) error { +func (r *EcallRecorder) RecordGetEncryptedSeed(height int64, certHash []byte, outp1 []byte, outp2 []byte) error { if r.db == nil { return nil } @@ -509,11 +509,16 @@ func (r *EcallRecorder) RecordGetEncryptedSeed(height int64, certHash []byte, ou defer r.mu.Unlock() key := makeSeedKey(height, certHash) - if err := r.db.Set(key, output); err != nil { + if err := r.db.Set(key, outp1); err != nil { return fmt.Errorf("failed to write to db: %w", err) } - logInfo("EcallRecorder", "Recorded GetEncryptedSeed success at height %d (%d bytes)", height, len(output)) + key2 := append(key, 0x01) + if err := r.db.Set(key2, outp2); err != nil { + return fmt.Errorf("failed to write to db: %w", err) + } + + logInfo("EcallRecorder", "Recorded GetEncryptedSeed success at height %d (%d bytes)", height, len(outp1)) return nil } @@ -538,9 +543,9 @@ func (r *EcallRecorder) RecordGetEncryptedSeedError(height int64, certHash []byt // ReplayGetEncryptedSeed retrieves recorded GetEncryptedSeed data for a given height // Returns (output, "", true) on recorded success, (nil, errMsg, true) on recorded error, (nil, "", false) if not found -func (r *EcallRecorder) ReplayGetEncryptedSeed(height int64, certHash []byte) (output []byte, errMsg string, found bool) { +func (r *EcallRecorder) ReplayGetEncryptedSeed(height int64, certHash []byte) (outp1 []byte, outp2 []byte, errMsg string, found bool) { if r.db == nil { - return nil, "", false + return nil, nil, "", false } r.mu.RLock() @@ -551,18 +556,24 @@ func (r *EcallRecorder) ReplayGetEncryptedSeed(height int64, certHash []byte) (o errVal, err := r.db.Get(errKey) if err == nil && errVal != nil && len(errVal) > 0 { logInfo("EcallRecorder", "Replayed GetEncryptedSeed error at height %d", height) - return nil, string(errVal), true + return nil, nil, string(errVal), true } // Check for success entry key := makeSeedKey(height, certHash) - value, err := r.db.Get(key) - if err != nil || value == nil { - return nil, "", false + outp1, err = r.db.Get(key) + if err != nil || outp1 == nil { + return nil, nil, "", false + } + + key2 := append(key, 0x01) + outp2, err = r.db.Get(key2) + if err != nil || outp2 == nil { + return nil, nil, "", false } - logInfo("EcallRecorder", "Replayed GetEncryptedSeed success at height %d (%d bytes)", height, len(value)) - return value, "", true + logInfo("EcallRecorder", "Replayed GetEncryptedSeed success at height %d (%d bytes)", height, len(outp1)) + return outp1, outp2, "", true } // --- ExecutionTrace recording (for contract executions) --- diff --git a/go-cosmwasm/api/ecall_record_stub.go b/go-cosmwasm/api/ecall_record_stub.go index 26f0ed4ab2..f42bec2a8f 100644 --- a/go-cosmwasm/api/ecall_record_stub.go +++ b/go-cosmwasm/api/ecall_record_stub.go @@ -81,7 +81,7 @@ func (r *EcallRecorder) DeleteRecordsBeforeHeight(height int64) error { return nil } -func (r *EcallRecorder) RecordGetEncryptedSeed(height int64, certHash []byte, output []byte) error { +func (r *EcallRecorder) RecordGetEncryptedSeed(height int64, certHash []byte, outp1 []byte, outp2 []byte) error { return nil } @@ -89,8 +89,8 @@ func (r *EcallRecorder) RecordGetEncryptedSeedError(height int64, certHash []byt return nil } -func (r *EcallRecorder) ReplayGetEncryptedSeed(height int64, certHash []byte) (output []byte, errMsg string, found bool) { - return nil, "", false +func (r *EcallRecorder) ReplayGetEncryptedSeed(height int64, certHash []byte) (outp1 []byte, outp2 []byte, errMsg string, found bool) { + return nil, nil, "", false } func (r *EcallRecorder) RecordMachineIDProof(height int64, machineID []byte, proof []byte) error { diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index 98053cc9a2..8cfb60e171 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -274,21 +274,27 @@ func OnApproveMachineID(machineID []byte) error { if err != nil { return err } - if !ret { - return errors.New("onchain_approve_machine_id failed") - } recorder := GetRecorder() if recorder.IsSGXMode() { height := recorder.GetCurrentBlockHeight() machineIDHex := hex.EncodeToString(machineID) - if recErr := recorder.RecordMachineIDProof(height, []byte(machineIDHex), proof[:]); recErr != nil { + + var add_result byte + if ret { + add_result = 1 + } + if recErr := recorder.RecordMachineIDProof(height, []byte(machineIDHex), []byte{add_result}); recErr != nil { logError("OnApproveMachineID", "Failed to record machine ID proof for replay: %v", recErr) } else { logInfo("OnApproveMachineID", "Recorded MachineIDProof for %s at height %d", machineIDHex, height) } } + if !ret { + return errors.New("onchain_approve_machine_id failed") + } + return nil } @@ -948,26 +954,26 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e if recorder.IsReplayMode() { // Try local DB first height := recorder.GetCurrentBlockHeight() - if output, errMsg, found := recorder.ReplayGetEncryptedSeed(height, certHash[:]); found { + if outp1, outp2, errMsg, found := recorder.ReplayGetEncryptedSeed(height, certHash[:]); found { if errMsg != "" { // Replay the exact same error the SGX enclave produced - return nil, fmt.Errorf("%s", errMsg) + return nil, nil, fmt.Errorf("%s", errMsg) } - return output, nil + return outp1, outp2, nil } // Fetch from remote SGX node client := GetEcallClient() - output, err := client.FetchEncryptedSeed(height, certHashHex) + outp1, outp2, err := client.FetchEncryptedSeed(height, certHashHex) if err != nil { - return nil, fmt.Errorf("GetEncryptedSeed replay failed: %w", err) + return nil, nil, fmt.Errorf("GetEncryptedSeed replay failed: %w", err) } // Cache locally - if cacheErr := recorder.RecordGetEncryptedSeed(height, certHash[:], output); cacheErr != nil { + if cacheErr := recorder.RecordGetEncryptedSeed(height, certHash[:], outp1, outp2); cacheErr != nil { logError("GetEncryptedSeed", "Failed to cache: %v", cacheErr) } - return output, nil + return outp2, outp2, nil } // SGX mode: call enclave and record result @@ -990,8 +996,8 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e output := receiveVector(res) height := recorder.GetCurrentBlockHeight() - logInfo("GetEncryptedSeed", "SGX enclave SUCCESS for %s (%d bytes), recording at height %d...", certHashHex, len(output), height) - if err := recorder.RecordGetEncryptedSeed(height, certHash[:], output); err != nil { + logInfo("GetEncryptedSeed", "SGX enclave SUCCESS for %s (%d bytes), recording at height %d...", certHashHex, len(output1), height) + if err := recorder.RecordGetEncryptedSeed(height, certHash[:], output1, output2); err != nil { logError("GetEncryptedSeed", "Failed to record: %v", err) } else { logInfo("GetEncryptedSeed", "Recorded GetEncryptedSeed for %s OK", certHashHex) diff --git a/go-cosmwasm/api/lib_nosgx.go b/go-cosmwasm/api/lib_nosgx.go index 9e19d91490..94b40021fc 100644 --- a/go-cosmwasm/api/lib_nosgx.go +++ b/go-cosmwasm/api/lib_nosgx.go @@ -297,7 +297,7 @@ func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { return nodePk, ioPk } -func GetEncryptedSeed(cert []byte) ([]byte, error) { +func GetEncryptedSeed(cert []byte) ([]byte, []byte, error) { recorder := GetRecorder() certHash := sha256.Sum256(cert) certHashHex := hex.EncodeToString(certHash[:]) @@ -308,13 +308,13 @@ func GetEncryptedSeed(cert []byte) ([]byte, error) { height := recorder.GetCurrentBlockHeight() // Try local DB first - if output, errMsg, found := recorder.ReplayGetEncryptedSeed(height, certHash[:]); found { + if outp1, outp2, errMsg, found := recorder.ReplayGetEncryptedSeed(height, certHash[:]); found { if errMsg != "" { logInfo("GetEncryptedSeed", "Found CACHED ERROR in local DB for %s: %s", certHashHex, errMsg) - return nil, fmt.Errorf("%s", errMsg) + return nil, nil, fmt.Errorf("%s", errMsg) } - logInfo("GetEncryptedSeed", "Found CACHED SUCCESS in local DB for %s (%d bytes)", certHashHex, len(output)) - return output, nil + logInfo("GetEncryptedSeed", "Found CACHED SUCCESS in local DB for %s (%d bytes)", certHashHex, len(outp1)) + return outp1, outp2, nil } logInfo("GetEncryptedSeed", "NOT in local DB for %s, will fetch from SGX node via gRPC", certHashHex) @@ -327,15 +327,15 @@ func GetEncryptedSeed(cert []byte) ([]byte, error) { var lastErr error for attempt := 0; attempt < maxRetries; attempt++ { - output, err := client.FetchEncryptedSeed(height, certHashHex) + outp1, outp2, err := client.FetchEncryptedSeed(height, certHashHex) if err == nil { logInfo("GetEncryptedSeed", "Fetched seed from SGX node (attempt %d) for %s (%d bytes)", - attempt+1, certHashHex, len(output)) + attempt+1, certHashHex, len(outp1)) // Cache locally - if cacheErr := recorder.RecordGetEncryptedSeed(height, certHash[:], output); cacheErr != nil { + if cacheErr := recorder.RecordGetEncryptedSeed(height, certHash[:], outp1, outp2); cacheErr != nil { logError("GetEncryptedSeed", "Failed to cache: %v", cacheErr) } - return output, nil + return outp1, outp2, nil } // Extract gRPC status for logging @@ -358,7 +358,7 @@ func GetEncryptedSeed(cert []byte) ([]byte, error) { if cacheErr := recorder.RecordGetEncryptedSeedError(height, certHash[:], enclaveErrMsg); cacheErr != nil { logError("GetEncryptedSeed", "Failed to cache error: %v", cacheErr) } - return nil, fmt.Errorf("%s", enclaveErrMsg) + return nil, nil, fmt.Errorf("%s", enclaveErrMsg) } lastErr = err @@ -386,7 +386,7 @@ func GetEncryptedSeed(cert []byte) ([]byte, error) { } logError("GetEncryptedSeed", "EXHAUSTED all %d retries for %s. lastErr: %v", maxRetries, certHashHex, lastErr) - return nil, fmt.Errorf("GetEncryptedSeed: failed after %d retries for cert hash %s: %v", maxRetries, certHashHex, lastErr) + return nil, nil, fmt.Errorf("GetEncryptedSeed: failed after %d retries for cert hash %s: %v", maxRetries, certHashHex, lastErr) } func GetEncryptedGenesisSeed(cert []byte) ([]byte, error) { @@ -397,7 +397,7 @@ func OnUpgradeProposalPassed(mrEnclaveHash []byte) error { return nil } -func OnApproveMachineID(machineID []byte, proof *[32]byte, is_on_chain bool) error { +func OnApproveMachineID(machineID []byte) error { recorder := GetRecorder() height := recorder.GetCurrentBlockHeight() @@ -418,6 +418,15 @@ func OnApproveMachineID(machineID []byte, proof *[32]byte, is_on_chain bool) err for { data, err := client.FetchMachineIDProof(height, machineIDHex) + if err == nil && len(data) > 0 { + logInfo("OnApproveMachineID", "Fetched proof from SGX node: height=%d (attempt %d)", height, attempt+1) + + if (data[0] != 0) + return nil + + return errors.New("machine not approved") + } + if err == nil && len(data) > 0 { logInfo("OnApproveMachineID", "Fetched proof from SGX node: height=%d (attempt %d)", height, attempt+1) copy(proof[:], data) diff --git a/proto/secret/compute/v1beta1/query.proto b/proto/secret/compute/v1beta1/query.proto index ad2b334c39..34f616ae18 100644 --- a/proto/secret/compute/v1beta1/query.proto +++ b/proto/secret/compute/v1beta1/query.proto @@ -313,6 +313,8 @@ message QueryEncryptedSeedRequest { message QueryEncryptedSeedResponse { // Encrypted seed data bytes encrypted_seed = 1; + // Machine binding + bytes machine_binding = 2; } // StorageOp represents a single storage operation (Set or Delete) diff --git a/x/compute/internal/keeper/querier.go b/x/compute/internal/keeper/querier.go index 1a7286fcf3..63c18d910c 100644 --- a/x/compute/internal/keeper/querier.go +++ b/x/compute/internal/keeper/querier.go @@ -407,7 +407,7 @@ func (q GrpcQuerier) EncryptedSeed(c context.Context, req *types.QueryEncryptedS } recorder := api.GetRecorder() - encryptedSeed, errMsg, found := recorder.ReplayGetEncryptedSeed(req.Height, certHash) + outp1, outp2, errMsg, found := recorder.ReplayGetEncryptedSeed(req.Height, certHash) if !found { fmt.Printf("[INFO] gRPC EncryptedSeed: NOT FOUND in DB for certHash=%s height=%d\n", req.CertHash, req.Height) return nil, status.Error(codes.NotFound, "no encrypted seed found for the given certificate hash") @@ -418,10 +418,11 @@ func (q GrpcQuerier) EncryptedSeed(c context.Context, req *types.QueryEncryptedS return nil, status.Error(codes.FailedPrecondition, errMsg) } - fmt.Printf("[INFO] gRPC EncryptedSeed: found SUCCESS for certHash=%s height=%d seedLen=%d\n", req.CertHash, req.Height, len(encryptedSeed)) + fmt.Printf("[INFO] gRPC EncryptedSeed: found SUCCESS for certHash=%s height=%d seedLen=%d\n", req.CertHash, req.Height, len(outp1)) return &types.QueryEncryptedSeedResponse{ - EncryptedSeed: encryptedSeed, + EncryptedSeed: outp1, + MachineBinding: outp2, }, nil } diff --git a/x/compute/internal/types/query.pb.go b/x/compute/internal/types/query.pb.go index e1036a42b0..1f82743bb6 100644 --- a/x/compute/internal/types/query.pb.go +++ b/x/compute/internal/types/query.pb.go @@ -920,7 +920,8 @@ func (m *QueryAuthorizedAdminUpdateRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAuthorizedAdminUpdateRequest proto.InternalMessageInfo type QueryAuthorizedAdminUpdateResponse struct { - // Authorized new admin address (empty string if removing admin, or if no authorization) + // Authorized new admin address (empty string if removing admin, or if no + // authorization) NewAdmin string `protobuf:"bytes,1,opt,name=new_admin,json=newAdmin,proto3" json:"new_admin,omitempty"` } @@ -957,7 +958,8 @@ func (m *QueryAuthorizedAdminUpdateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAuthorizedAdminUpdateResponse proto.InternalMessageInfo -// QueryEcallRecordRequest is the request type for the Query/EcallRecord RPC method +// QueryEcallRecordRequest is the request type for the Query/EcallRecord RPC +// method type QueryEcallRecordRequest struct { // Block height to query ecall record for Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` @@ -996,7 +998,8 @@ func (m *QueryEcallRecordRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEcallRecordRequest proto.InternalMessageInfo -// QueryEcallRecordResponse is the response type for the Query/EcallRecord RPC method +// QueryEcallRecordResponse is the response type for the Query/EcallRecord RPC +// method type QueryEcallRecordResponse struct { // Block height Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` @@ -1080,7 +1083,8 @@ func (m *QueryNetworkPubkeyRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryNetworkPubkeyRequest proto.InternalMessageInfo -// QueryNetworkPubkeyResponse is the response type for the Query/NetworkPubkey RPC +// QueryNetworkPubkeyResponse is the response type for the Query/NetworkPubkey +// RPC type QueryNetworkPubkeyResponse struct { NodePubkey []byte `protobuf:"bytes,1,opt,name=node_pubkey,json=nodePubkey,proto3" json:"node_pubkey,omitempty"` IoPubkey []byte `protobuf:"bytes,2,opt,name=io_pubkey,json=ioPubkey,proto3" json:"io_pubkey,omitempty"` @@ -1119,7 +1123,8 @@ func (m *QueryNetworkPubkeyResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryNetworkPubkeyResponse proto.InternalMessageInfo -// QueryEcallRecordsRequest is the request type for the Query/EcallRecords RPC method +// QueryEcallRecordsRequest is the request type for the Query/EcallRecords RPC +// method type QueryEcallRecordsRequest struct { // Start block height (inclusive) StartHeight int64 `protobuf:"varint,1,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` @@ -1160,7 +1165,8 @@ func (m *QueryEcallRecordsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEcallRecordsRequest proto.InternalMessageInfo -// QueryEcallRecordsResponse is the response type for the Query/EcallRecords RPC method +// QueryEcallRecordsResponse is the response type for the Query/EcallRecords RPC +// method type QueryEcallRecordsResponse struct { // List of ecall records Records []QueryEcallRecordResponse `protobuf:"bytes,1,rep,name=records,proto3" json:"records"` @@ -1199,11 +1205,13 @@ func (m *QueryEcallRecordsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEcallRecordsResponse proto.InternalMessageInfo -// QueryEncryptedSeedRequest is the request type for the Query/EncryptedSeed RPC method +// QueryEncryptedSeedRequest is the request type for the Query/EncryptedSeed RPC +// method type QueryEncryptedSeedRequest struct { // Certificate hash (hex encoded sha256 of certificate) CertHash string `protobuf:"bytes,1,opt,name=cert_hash,json=certHash,proto3" json:"cert_hash,omitempty"` - // Block height at which the seed was recorded (required for per-height keying) + // Block height at which the seed was recorded (required for per-height + // keying) Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` } @@ -1240,10 +1248,13 @@ func (m *QueryEncryptedSeedRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEncryptedSeedRequest proto.InternalMessageInfo -// QueryEncryptedSeedResponse is the response type for the Query/EncryptedSeed RPC method +// QueryEncryptedSeedResponse is the response type for the Query/EncryptedSeed +// RPC method type QueryEncryptedSeedResponse struct { // Encrypted seed data EncryptedSeed []byte `protobuf:"bytes,1,opt,name=encrypted_seed,json=encryptedSeed,proto3" json:"encrypted_seed,omitempty"` + // Machine binding + MachineBinding []byte `protobuf:"bytes,2,opt,name=machine_binding,json=machineBinding,proto3" json:"machine_binding,omitempty"` } func (m *QueryEncryptedSeedResponse) Reset() { *m = QueryEncryptedSeedResponse{} } @@ -1420,7 +1431,8 @@ func (m *ExecutionTraceData) XXX_DiscardUnknown() { var xxx_messageInfo_ExecutionTraceData proto.InternalMessageInfo -// QueryBlockTracesRequest is the request type for the Query/BlockTraces RPC method +// QueryBlockTracesRequest is the request type for the Query/BlockTraces RPC +// method type QueryBlockTracesRequest struct { // Block height to query traces for Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` @@ -1459,7 +1471,8 @@ func (m *QueryBlockTracesRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryBlockTracesRequest proto.InternalMessageInfo -// QueryBlockTracesResponse is the response type for the Query/BlockTraces RPC method +// QueryBlockTracesResponse is the response type for the Query/BlockTraces RPC +// method type QueryBlockTracesResponse struct { // All execution traces for the block Traces []ExecutionTraceData `protobuf:"bytes,1,rep,name=traces,proto3" json:"traces"` @@ -1498,7 +1511,8 @@ func (m *QueryBlockTracesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryBlockTracesResponse proto.InternalMessageInfo -// QueryMachineIDProofRequest is the request type for the Query/MachineIDProof RPC method +// QueryMachineIDProofRequest is the request type for the Query/MachineIDProof +// RPC method type QueryMachineIDProofRequest struct { // Block height where the machine ID was approved Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` @@ -1539,7 +1553,8 @@ func (m *QueryMachineIDProofRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryMachineIDProofRequest proto.InternalMessageInfo -// QueryMachineIDProofResponse is the response type for the Query/MachineIDProof RPC method +// QueryMachineIDProofResponse is the response type for the Query/MachineIDProof +// RPC method type QueryMachineIDProofResponse struct { // Proof bytes (32 bytes) Proof []byte `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"` @@ -1578,7 +1593,8 @@ func (m *QueryMachineIDProofResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryMachineIDProofResponse proto.InternalMessageInfo -// QueryAnalyzeCodeRequest is the request type for the Query/AnalyzeCode RPC method +// QueryAnalyzeCodeRequest is the request type for the Query/AnalyzeCode RPC +// method type QueryAnalyzeCodeRequest struct { // Code hash (raw bytes, typically 32 bytes SHA256) CodeHash []byte `protobuf:"bytes,1,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` @@ -1617,9 +1633,11 @@ func (m *QueryAnalyzeCodeRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAnalyzeCodeRequest proto.InternalMessageInfo -// QueryAnalyzeCodeResponse is the response type for the Query/AnalyzeCode RPC method +// QueryAnalyzeCodeResponse is the response type for the Query/AnalyzeCode RPC +// method type QueryAnalyzeCodeResponse struct { - // Whether the code has IBC entry points (ibc_channel_open, ibc_channel_connect, etc.) + // Whether the code has IBC entry points (ibc_channel_open, + // ibc_channel_connect, etc.) HasIbcEntryPoints bool `protobuf:"varint,1,opt,name=has_ibc_entry_points,json=hasIbcEntryPoints,proto3" json:"has_ibc_entry_points,omitempty"` // Comma-separated list of required features (e.g., "staking", "stargate") RequiredFeatures string `protobuf:"bytes,2,opt,name=required_features,json=requiredFeatures,proto3" json:"required_features,omitempty"` @@ -1703,7 +1721,8 @@ func (m *CreateResultData) XXX_DiscardUnknown() { var xxx_messageInfo_CreateResultData proto.InternalMessageInfo -// QueryBlockCreateResultsRequest is the request type for the Query/BlockCreateResults RPC method +// QueryBlockCreateResultsRequest is the request type for the +// Query/BlockCreateResults RPC method type QueryBlockCreateResultsRequest struct { // Block height to query Create results for Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` @@ -1742,7 +1761,8 @@ func (m *QueryBlockCreateResultsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryBlockCreateResultsRequest proto.InternalMessageInfo -// QueryBlockCreateResultsResponse is the response type for the Query/BlockCreateResults RPC method +// QueryBlockCreateResultsResponse is the response type for the +// Query/BlockCreateResults RPC method type QueryBlockCreateResultsResponse struct { // All Create results for the block Results []CreateResultData `protobuf:"bytes,1,rep,name=results,proto3" json:"results"` @@ -1833,161 +1853,162 @@ func init() { } var fileDescriptor_7735281c5fa969d4 = []byte{ - // 2453 bytes of a gzipped FileDescriptorProto + // 2472 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x4b, 0x6c, 0x1c, 0x49, - 0x19, 0x76, 0xfb, 0x3d, 0xbf, 0x1f, 0x49, 0x6a, 0x1d, 0xc7, 0x99, 0x6c, 0xc6, 0x9b, 0x62, 0xb3, - 0x71, 0x92, 0xcd, 0x74, 0x6c, 0x87, 0xbc, 0x58, 0x04, 0xb6, 0x63, 0x88, 0x97, 0x3c, 0xbc, 0xe3, - 0x5d, 0x21, 0xad, 0x82, 0x5a, 0x35, 0xdd, 0x95, 0x99, 0x96, 0x67, 0xba, 0x27, 0x5d, 0x35, 0xb6, - 0x67, 0x23, 0x73, 0xe0, 0xc0, 0xe3, 0x86, 0xc4, 0x22, 0xb4, 0xe2, 0xb2, 0x27, 0x58, 0x81, 0x84, - 0xc4, 0x75, 0x25, 0xc4, 0x35, 0x42, 0x1c, 0x22, 0xed, 0x85, 0x53, 0x04, 0x09, 0x07, 0xc4, 0x9d, - 0x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d, 0xc7, 0x99, 0x6c, 0xc6, 0x49, 0xb3, 0x49, + 0x9c, 0x64, 0x33, 0x1d, 0xdb, 0x21, 0x2f, 0x16, 0x81, 0x9d, 0x18, 0xe2, 0x25, 0x0f, 0xef, 0x78, + 0x57, 0x48, 0xab, 0xa0, 0x56, 0x4d, 0x77, 0x65, 0xa6, 0xe5, 0x99, 0xee, 0x49, 0x57, 0x8f, 0xed, + 0xd9, 0xc8, 0x1c, 0x38, 0xf0, 0xb8, 0x21, 0xb1, 0x08, 0xad, 0xb8, 0xec, 0x09, 0x56, 0x20, 0x21, + 0x71, 0x5d, 0x09, 0x71, 0x8d, 0x10, 0x87, 0x48, 0x7b, 0xe1, 0x14, 0x41, 0xc2, 0x01, 0x71, 0xe7, + 0x8e, 0xaa, 0xea, 0xef, 0x9e, 0xee, 0x99, 0x9e, 0xe9, 0x71, 0x38, 0x70, 0x9b, 0xae, 0xfa, 0x1f, + 0xdf, 0xff, 0xa8, 0xbf, 0xea, 0xff, 0x6d, 0xd0, 0x39, 0xb3, 0x7c, 0x16, 0x18, 0x96, 0x57, 0x6f, + 0x34, 0x03, 0x66, 0xec, 0x2e, 0x97, 0x59, 0x40, 0x97, 0x8d, 0xa7, 0x4d, 0xe6, 0xb7, 0x8a, 0x0d, + 0xdf, 0x0b, 0x3c, 0x32, 0xaf, 0x68, 0x8a, 0x48, 0x53, 0x44, 0x9a, 0xfc, 0x5c, 0xc5, 0xab, 0x78, + 0x92, 0xc4, 0x10, 0xbf, 0x14, 0x75, 0xbe, 0x97, 0xc4, 0xa0, 0xd5, 0x60, 0x1c, 0x69, 0xbe, 0xd6, + 0x83, 0xa6, 0x41, 0x7d, 0x5a, 0x0f, 0x89, 0x4e, 0x55, 0x3c, 0xaf, 0x52, 0x63, 0x86, 0xfc, 0x2a, + 0x37, 0x9f, 0x18, 0xac, 0xde, 0x08, 0x10, 0x53, 0xfe, 0x6d, 0xdc, 0xa4, 0x0d, 0xc7, 0xa0, 0xae, + 0xeb, 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, 0x37, 0x9d, 0x9a, + 0xcd, 0xfc, 0x85, 0x31, 0x25, 0x0e, 0x3f, 0xf5, 0x7d, 0x38, 0x86, 0x6e, 0xb1, 0x59, 0x04, 0xeb, + 0x11, 0xea, 0x90, 0xce, 0x57, 0x07, 0x7d, 0xa9, 0xb7, 0x13, 0x92, 0x36, 0xc5, 0x02, 0x20, 0x71, + 0x89, 0x3d, 0x91, 0xca, 0x7b, 0x94, 0xd7, 0xf1, 0xa0, 0xca, 0xdf, 0xba, 0x05, 0x24, 0xd2, 0xdc, + 0x2e, 0x30, 0x0f, 0x00, 0x22, 0xd5, 0x61, 0x00, 0x06, 0xd7, 0xad, 0x3c, 0x9f, 0x0b, 0xf5, 0x72, + 0x7d, 0x13, 0xde, 0x4e, 0x44, 0x3d, 0x3a, 0xdd, 0x87, 0x3e, 0x31, 0xfa, 0x0a, 0x96, 0xad, 0x50, + 0x14, 0x56, 0x17, 0x14, 0x94, 0x5e, 0x5e, 0xae, 0xc1, 0xf1, 0xc8, 0x46, 0x11, 0xa0, 0x88, 0x3c, + 0x11, 0x45, 0x2d, 0x19, 0x45, 0xfd, 0x97, 0x1a, 0x1c, 0xb9, 0xcb, 0x2c, 0xbf, 0xd5, 0x08, 0x98, + 0xbd, 0xe6, 0xf2, 0x3d, 0xe6, 0x0b, 0x0f, 0x8a, 0xbb, 0x05, 0x69, 0xe5, 0x6f, 0xa1, 0xd3, 0x71, + 0x1b, 0xcd, 0x00, 0x53, 0x44, 0x7d, 0x90, 0x45, 0x98, 0xf2, 0x9a, 0x41, 0xa3, 0x19, 0x98, 0xb2, + 0x7a, 0xa8, 0x14, 0x01, 0xb5, 0x74, 0x97, 0x06, 0x94, 0x2c, 0xc3, 0xf1, 0x18, 0x81, 0x49, 0xb9, + 0xc9, 0x03, 0xdf, 0x71, 0x2b, 0x98, 0x33, 0xa4, 0x4d, 0xba, 0xc6, 0xb7, 0xe5, 0x0e, 0x16, 0xee, + 0xff, 0x68, 0x70, 0xb4, 0x03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 0x3f, 0x0a, 0x43, 0x5f, 0xbc, 0x2a, 0x68, 0xcf, 0x5f, 0x15, 0xb4, 0x17, 0xaf, + 0x0a, 0xda, 0xdf, 0x5f, 0x15, 0xb4, 0x9f, 0xbf, 0x2e, 0x0c, 0xbd, 0x78, 0x5d, 0x18, 0xfa, 0xdb, + 0xeb, 0xc2, 0xd0, 0xc7, 0xb7, 0x2b, 0x4e, 0x50, 0x6d, 0x96, 0x05, 0x22, 0x83, 0x5b, 0x7e, 0x50, + 0xa3, 0x65, 0x6e, 0xa8, 0xae, 0x03, 0x4f, 0xbd, 0xb1, 0x1f, 0x29, 0x75, 0xdc, 0x80, 0xf9, 0x2e, + 0xad, 0xa9, 0x7f, 0x19, 0x28, 0x8f, 0xcb, 0x67, 0xfb, 0xea, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x31, 0x2f, 0xc0, 0x99, 0xab, 0x20, 0x00, 0x00, } func (this *ParamsRequest) Equal(that interface{}) bool { @@ -2690,6 +2711,9 @@ func (this *QueryEncryptedSeedResponse) Equal(that interface{}) bool { if !bytes.Equal(this.EncryptedSeed, that1.EncryptedSeed) { return false } + if !bytes.Equal(this.MachineBinding, that1.MachineBinding) { + return false + } return true } func (this *StorageOp) Equal(that interface{}) bool { @@ -3101,7 +3125,8 @@ type QueryClient interface { EncryptedSeed(ctx context.Context, in *QueryEncryptedSeedRequest, opts ...grpc.CallOption) (*QueryEncryptedSeedResponse, error) // Query all execution traces for a block (batch fetch for non-SGX node sync) BlockTraces(ctx context.Context, in *QueryBlockTracesRequest, opts ...grpc.CallOption) (*QueryBlockTracesResponse, error) - // Query machine ID proof for a specific block height and machine ID (for non-SGX node sync) + // Query machine ID proof for a specific block height and machine ID (for + // non-SGX node sync) MachineIDProof(ctx context.Context, in *QueryMachineIDProofRequest, opts ...grpc.CallOption) (*QueryMachineIDProofResponse, error) // Analyze code to determine IBC entry points and required features AnalyzeCode(ctx context.Context, in *QueryAnalyzeCodeRequest, opts ...grpc.CallOption) (*QueryAnalyzeCodeResponse, error) @@ -3345,7 +3370,8 @@ type QueryServer interface { EncryptedSeed(context.Context, *QueryEncryptedSeedRequest) (*QueryEncryptedSeedResponse, error) // Query all execution traces for a block (batch fetch for non-SGX node sync) BlockTraces(context.Context, *QueryBlockTracesRequest) (*QueryBlockTracesResponse, error) - // Query machine ID proof for a specific block height and machine ID (for non-SGX node sync) + // Query machine ID proof for a specific block height and machine ID (for + // non-SGX node sync) MachineIDProof(context.Context, *QueryMachineIDProofRequest) (*QueryMachineIDProofResponse, error) // Analyze code to determine IBC entry points and required features AnalyzeCode(context.Context, *QueryAnalyzeCodeRequest) (*QueryAnalyzeCodeResponse, error) @@ -5019,6 +5045,13 @@ func (m *QueryEncryptedSeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, err _ = i var l int _ = l + if len(m.MachineBinding) > 0 { + i -= len(m.MachineBinding) + copy(dAtA[i:], m.MachineBinding) + i = encodeVarintQuery(dAtA, i, uint64(len(m.MachineBinding))) + i-- + dAtA[i] = 0x12 + } if len(m.EncryptedSeed) > 0 { i -= len(m.EncryptedSeed) copy(dAtA[i:], m.EncryptedSeed) @@ -6039,6 +6072,10 @@ func (m *QueryEncryptedSeedResponse) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.MachineBinding) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -9391,6 +9428,40 @@ func (m *QueryEncryptedSeedResponse) Unmarshal(dAtA []byte) error { m.EncryptedSeed = []byte{} } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MachineBinding", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MachineBinding = append(m.MachineBinding[:0], dAtA[iNdEx:postIndex]...) + if m.MachineBinding == nil { + m.MachineBinding = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From a04a82c6d2eaa999c8eccaf70b84989d02ebce5f Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 14 May 2026 14:54:52 +0000 Subject: [PATCH 37/55] build fix (2) --- go-cosmwasm/api/lib_nosgx.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/go-cosmwasm/api/lib_nosgx.go b/go-cosmwasm/api/lib_nosgx.go index 94b40021fc..3ac419a9a3 100644 --- a/go-cosmwasm/api/lib_nosgx.go +++ b/go-cosmwasm/api/lib_nosgx.go @@ -280,7 +280,7 @@ func KeyGen() ([]byte, error) { return make([]byte, 32), nil } -func CreateAttestationReport(is_migration_report bool) (bool, error) { +func CreateAttestationReport(ext_sk []byte, is_migration_report bool) (bool, error) { logInfo("CreateAttestationReport", "Skipped in replay mode") return true, nil } @@ -297,7 +297,7 @@ func GetNetworkPubkey(i_seed uint32) ([]byte, []byte) { return nodePk, ioPk } -func GetEncryptedSeed(cert []byte) ([]byte, []byte, error) { +func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, error) { recorder := GetRecorder() certHash := sha256.Sum256(cert) certHashHex := hex.EncodeToString(certHash[:]) @@ -420,16 +420,16 @@ func OnApproveMachineID(machineID []byte) error { data, err := client.FetchMachineIDProof(height, machineIDHex) if err == nil && len(data) > 0 { logInfo("OnApproveMachineID", "Fetched proof from SGX node: height=%d (attempt %d)", height, attempt+1) - - if (data[0] != 0) + + if data[0] != 0 { return nil + } return errors.New("machine not approved") } if err == nil && len(data) > 0 { logInfo("OnApproveMachineID", "Fetched proof from SGX node: height=%d (attempt %d)", height, attempt+1) - copy(proof[:], data) return nil } @@ -440,3 +440,7 @@ func OnApproveMachineID(machineID []byte) error { time.Sleep(retryDelay) } } + +func SubmitMachineSwap(index uint32, machineInfo []byte, proof []byte) error { + return nil +} From 5194fa3d852e2f60b597a039d759b6389bacce43 Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 14 May 2026 15:22:28 +0000 Subject: [PATCH 38/55] build fix (merge artifacts) --- go-cosmwasm/api/lib.go | 9 +++++---- go.sum | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index 8cfb60e171..b13e00c74c 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -53,7 +53,7 @@ func HealthCheck() ([]byte, error) { return receiveVector(res), nil } -func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom []byte, cronMsgs []byte /* valSet []byte, nextValSet []byte */) ([]byte, []byte, error) { +func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom []byte /* valSet []byte, nextValSet []byte */) ([]byte, []byte, error) { recorder := GetRecorder() if recorder.IsReplayMode() { return nil, nil, errors.New("submit block signatures not supported on non-SGX node") @@ -991,10 +991,11 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e if recErr := recorder.RecordGetEncryptedSeedError(height, certHash[:], enclaveErr.Error()); recErr != nil { logError("GetEncryptedSeed", "Failed to record error: %v", recErr) } - return nil, enclaveErr + return nil, nil, enclaveErr } - output := receiveVector(res) + output1 := receiveVector(res.buf1) + output2 := receiveVector(res.buf2) height := recorder.GetCurrentBlockHeight() logInfo("GetEncryptedSeed", "SGX enclave SUCCESS for %s (%d bytes), recording at height %d...", certHashHex, len(output1), height) if err := recorder.RecordGetEncryptedSeed(height, certHash[:], output1, output2); err != nil { @@ -1002,7 +1003,7 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e } else { logInfo("GetEncryptedSeed", "Recorded GetEncryptedSeed for %s OK", certHashHex) } - return output, nil + return output1, output2, nil } func GetEncryptedGenesisSeed(pk []byte) ([]byte, error) { diff --git a/go.sum b/go.sum index afb5b1ea08..05d26a0c15 100644 --- a/go.sum +++ b/go.sum @@ -1609,8 +1609,8 @@ github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWR github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.3.9 h1:fiaT9rB7g5sr5ddNZvlwheclN9IP86eFW9WgqlEQV+w= github.com/sasha-s/go-deadlock v0.3.9/go.mod h1:KuZj51ZFmx42q/mPaYbRk0P1xcwe697zsJKE03vD4/Y= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.11 h1:Yl1x19k6jIFXPDX/Rrj1p4z7EsQDVhNJt0gX1/JuJsM= -github.com/scrtlabs/cosmos-sdk v0.50.14-secret.11/go.mod h1:b7GmzR/8Ic9g6Aswsm3ryLhE5dhgbKTJ6o78mhxjRO4= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12 h1:PWRZGsDaEVGkBleaoKwCcKdFejRFEV3F+P15P/ux0BQ= +github.com/scrtlabs/cosmos-sdk v0.50.14-secret.12/go.mod h1:oAqAIxM6W1HXLs/Id+58e5tTdtm5OE35AFj+UsgTtGk= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0 h1:9IGLySVhC2qSrxT3fZvvqwjKsnXWSSKnywQDzT8y1Gs= github.com/scrtlabs/cosmos-sdk-api v0.7.6-secret.0/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= github.com/scrtlabs/cosmos-sdk-store v1.1.1-secret.1 h1:TELtwBkSg0xBrs2ObFE0pVVWF6E31fPCDX2tk8OiJPo= From 2b0ee8b0a273b53422ee2b577f67171dc5364390 Mon Sep 17 00:00:00 2001 From: vlad Date: Sun, 17 May 2026 13:24:34 +0000 Subject: [PATCH 39/55] attesation: changed print messages when validating machine --- .../enclaves/execute/src/registration/attestation.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index cb3e4e9805..925b59a667 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -855,13 +855,9 @@ pub fn verify_quote_sgx( let is_in_wl = match &machine_id_opt { Some(machine_id_hash) => { + println!("Machine ID: {}", orig_hex::encode(machine_id_hash)); let wl = PPID_WHITELIST.lock().unwrap(); - if wl.m_to_o.contains_key(machine_id_hash) { - true - } else { - println!("Unknown Machine ID: {}", orig_hex::encode(machine_id_hash)); - false - } + wl.m_to_o.contains_key(machine_id_hash) } None => { println!("Machine ID couldn't be extracted"); @@ -880,6 +876,7 @@ pub fn verify_quote_sgx( }; if check_ppid_wl && (!is_in_wl && !jwt_token_valid) { + println!("Unknown Machine, JWT token not provided"); return Err(sgx_status_t::SGX_ERROR_UNEXPECTED); } From 155d0a7b87c0d17ad6f65cb85e13ccb83e869e95 Mon Sep 17 00:00:00 2001 From: vlad Date: Sun, 17 May 2026 13:25:28 +0000 Subject: [PATCH 40/55] Merge artifacts fix --- go-cosmwasm/api/ecall_client.go | 2 +- go-cosmwasm/api/lib.go | 2 +- go-cosmwasm/api/lib_nosgx.go | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/go-cosmwasm/api/ecall_client.go b/go-cosmwasm/api/ecall_client.go index 878ed11f38..a353bf3838 100644 --- a/go-cosmwasm/api/ecall_client.go +++ b/go-cosmwasm/api/ecall_client.go @@ -87,7 +87,7 @@ func (m *QueryEncryptedSeedRequest) ProtoMessage() {} // QueryEncryptedSeedResponse matches QueryEncryptedSeedResponse proto type QueryEncryptedSeedResponse struct { EncryptedSeed []byte `protobuf:"bytes,1,opt,name=encrypted_seed,json=encryptedSeed,proto3" json:"encrypted_seed,omitempty"` - MachineBinding []byte `protobuf:"bytes,1,opt,name=machine_binding,json=machineBinding,proto3" json:"machine_binding,omitempty"` + MachineBinding []byte `protobuf:"bytes,2,opt,name=machine_binding,json=machineBinding,proto3" json:"machine_binding,omitempty"` } func (m *QueryEncryptedSeedResponse) Reset() { *m = QueryEncryptedSeedResponse{} } diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index b13e00c74c..29c14b91fe 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -973,7 +973,7 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e if cacheErr := recorder.RecordGetEncryptedSeed(height, certHash[:], outp1, outp2); cacheErr != nil { logError("GetEncryptedSeed", "Failed to cache: %v", cacheErr) } - return outp2, outp2, nil + return outp1, outp2, nil } // SGX mode: call enclave and record result diff --git a/go-cosmwasm/api/lib_nosgx.go b/go-cosmwasm/api/lib_nosgx.go index 3ac419a9a3..75902404cf 100644 --- a/go-cosmwasm/api/lib_nosgx.go +++ b/go-cosmwasm/api/lib_nosgx.go @@ -428,11 +428,6 @@ func OnApproveMachineID(machineID []byte) error { return errors.New("machine not approved") } - if err == nil && len(data) > 0 { - logInfo("OnApproveMachineID", "Fetched proof from SGX node: height=%d (attempt %d)", height, attempt+1) - return nil - } - attempt++ if attempt%15 == 1 { // Log every ~30 seconds logWarn("OnApproveMachineID", "Waiting for SGX node proof: height=%d machineID=%s attempt=%d err=%v", height, machineIDHex, attempt, err) From dca007c3fc9f875080a71a7073e3f3a7e743fb76 Mon Sep 17 00:00:00 2001 From: vlad Date: Sun, 17 May 2026 13:49:16 +0000 Subject: [PATCH 41/55] added upgrade handler v1.25 --- app/app.go | 2 ++ app/upgrades/v1.25/upgrade.go | 39 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 app/upgrades/v1.25/upgrade.go diff --git a/app/app.go b/app/app.go index d2ff3a58fa..ccff4454f4 100644 --- a/app/app.go +++ b/app/app.go @@ -74,6 +74,7 @@ import ( v1_23_1 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.23.1" v1_23_2 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.23.2" v1_24 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.24" + v1_25 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.25" v1_4 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.4" v1_5 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.5" v1_6 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.6" @@ -156,6 +157,7 @@ var ( v1_23_1.Upgrade, v1_23_2.Upgrade, v1_24.Upgrade, + v1_25.Upgrade, } ) diff --git a/app/upgrades/v1.25/upgrade.go b/app/upgrades/v1.25/upgrade.go new file mode 100644 index 0000000000..1cdf4cdfad --- /dev/null +++ b/app/upgrades/v1.25/upgrade.go @@ -0,0 +1,39 @@ +package v1_25 + +import ( + "context" + "fmt" + "os" + + "cosmossdk.io/log" + store "cosmossdk.io/store/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/scrtlabs/SecretNetwork/app/keepers" + "github.com/scrtlabs/SecretNetwork/app/upgrades" +) + +const upgradeName = "v1.25" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: upgradeName, + CreateUpgradeHandler: createUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{}, +} + +func createUpgradeHandler(mm *module.Manager, _ *keepers.SecretAppKeepers, configurator module.Configurator, +) upgradetypes.UpgradeHandler { + return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + logger := log.NewLogger(os.Stderr) + logger.Info(` _ _ _____ _____ _____ _____ ______ `) + logger.Info(`| | | | __ \ / ____| __ \ /\ | __ \| ____|`) + logger.Info(`| | | | |__) | | __| |__) | / \ | | | | |__ `) + logger.Info(`| | | | ___/| | |_ | _ / / /\ \ | | | | __| `) + logger.Info(`| |__| | | | |__| | | \ \ / ____ \| |__| | |____ `) + logger.Info(` \____/|_| \_____|_| \_\/_/ \_\_____/|______|`) + + logger.Info(fmt.Sprintf("Running module migrations for %s...", upgradeName)) + + return mm.RunMigrations(ctx, configurator, vm) + } +} From e479d186bea32a9b2f54ff5154c528429b7c5193 Mon Sep 17 00:00:00 2001 From: vlad Date: Sun, 17 May 2026 17:45:49 +0000 Subject: [PATCH 42/55] non-sgx: disabled logInfo prints --- go-cosmwasm/api/ecall_client.go | 20 ++++++------- go-cosmwasm/api/ecall_record.go | 52 ++++++++++++++++----------------- go-cosmwasm/api/lib.go | 30 +++++++++---------- go-cosmwasm/api/lib_nosgx.go | 30 +++++++++---------- 4 files changed, 66 insertions(+), 66 deletions(-) diff --git a/go-cosmwasm/api/ecall_client.go b/go-cosmwasm/api/ecall_client.go index a353bf3838..7b26d346a2 100644 --- a/go-cosmwasm/api/ecall_client.go +++ b/go-cosmwasm/api/ecall_client.go @@ -308,7 +308,7 @@ func GetEcallClient() *EcallClient { if addrsFromFile := loadNodesFromJSON(configPath); len(addrsFromFile) > 0 { addrs = addrsFromFile - logInfo("EcallClient", "Loaded %d nodes from config file: %s", len(addrs), configPath) + // logInfo("EcallClient", "Loaded %d nodes from config file: %s", len(addrs), configPath) } else { // Fallback to env var grpcAddr := os.Getenv("SECRET_SGX_NODE_GRPC") @@ -316,7 +316,7 @@ func GetEcallClient() *EcallClient { grpcAddr = "localhost:9090" } addrs = []string{grpcAddr} - logInfo("EcallClient", "Using single node from env: %s", grpcAddr) + // logInfo("EcallClient", "Using single node from env: %s", grpcAddr) } nodes := make([]*nodeConn, len(addrs)) @@ -330,7 +330,7 @@ func GetEcallClient() *EcallClient { rng: rand.New(rand.NewSource(time.Now().UnixNano())), } - logInfo("EcallClient", "Initialized with %d SGX nodes", len(addrs)) + // logInfo("EcallClient", "Initialized with %d SGX nodes", len(addrs)) }) return globalClient } @@ -526,7 +526,7 @@ func (c *EcallClient) FetchEcallRecord(height int64) (*EcallRecordData, error) { } if height%1000 == 0 { - logInfo("EcallClient", "Fetched ecall record for height %d", height) + // logInfo("EcallClient", "Fetched ecall record for height %d", height) } return &EcallRecordData{ @@ -545,7 +545,7 @@ func (c *EcallClient) FetchEncryptedSeed(height int64, certHashHex string) ([]by return nil, nil, err // Return raw error to preserve gRPC status codes } - logInfo("EcallClient", "Fetched encrypted seed (%d bytes) at height %d", len(resp.EncryptedSeed), height) + // logInfo("EcallClient", "Fetched encrypted seed (%d bytes) at height %d", len(resp.EncryptedSeed), height) return resp.EncryptedSeed, resp.MachineBinding, nil } @@ -558,7 +558,7 @@ func (c *EcallClient) FetchMachineIDProof(height int64, machineIDHex string) ([] return nil, fmt.Errorf("gRPC MachineIDProof failed for height %d: %w", height, err) } - logInfo("EcallClient", "Fetched machine ID proof (%d bytes) for height %d", len(resp.Proof), height) + // logInfo("EcallClient", "Fetched machine ID proof (%d bytes) for height %d", len(resp.Proof), height) return resp.Proof, nil } @@ -616,7 +616,7 @@ func (c *EcallClient) FetchBlockTraces(height int64) ([]*ExecutionTrace, error) height, t.Index, len(t.Ops), len(t.Result), t.GasUsed, t.CallbackGas, t.HasError) } } else if height%1000 == 0 { - logInfo("EcallClient", "Fetched %d traces for block %d", len(traces), height) + // logInfo("EcallClient", "Fetched %d traces for block %d", len(traces), height) } return traces, nil } @@ -630,7 +630,7 @@ func (c *EcallClient) FetchAnalyzeCode(codeHash []byte) (bool, string, error) { return false, "", fmt.Errorf("gRPC AnalyzeCode failed for code hash %x: %w", codeHash, err) } - logInfo("EcallClient", "Fetched AnalyzeCode for %x: hasIBC=%v features=%s", codeHash, resp.HasIBCEntryPoints, resp.RequiredFeatures) + // logInfo("EcallClient", "Fetched AnalyzeCode for %x: hasIBC=%v features=%s", codeHash, resp.HasIBCEntryPoints, resp.RequiredFeatures) return resp.HasIBCEntryPoints, resp.RequiredFeatures, nil } @@ -671,7 +671,7 @@ func (c *EcallClient) FetchBlockCreateResults(height int64) ([]*CreateResult, [] } if len(results) > 0 { - logInfo("EcallClient", "Fetched %d Create results for block %d", len(results), height) + // logInfo("EcallClient", "Fetched %d Create results for block %d", len(results), height) } return results, wasmHashes, nil } @@ -685,6 +685,6 @@ func (c *EcallClient) FetchNetworkPubkey(height int64, iSeed uint32) ([]byte, [] return nil, nil, fmt.Errorf("gRPC NetworkPubkey failed for height %d seed %d: %w", height, iSeed, err) } - logInfo("EcallClient", "Fetched NetworkPubkey for height %d seed %d", height, iSeed) + // logInfo("EcallClient", "Fetched NetworkPubkey for height %d seed %d", height, iSeed) return resp.NodePubkey, resp.IoPubkey, nil } diff --git a/go-cosmwasm/api/ecall_record.go b/go-cosmwasm/api/ecall_record.go index ca804a0e62..b9272cfa6b 100644 --- a/go-cosmwasm/api/ecall_record.go +++ b/go-cosmwasm/api/ecall_record.go @@ -149,11 +149,11 @@ func GetRecorder() *EcallRecorder { pruneInterval: pruneInterval, blockTraces: make(map[int64]*ExecutionTrace), } - if mode == NodeModeReplay { - logInfo("EcallRecorder", "Initialized in replay mode (no local DB, fetches from remote)") - } else { - logInfo("EcallRecorder", "Initialized in %s mode (storing disabled)", mode) - } + // if mode == NodeModeReplay { + // logInfo("EcallRecorder", "Initialized in replay mode (no local DB, fetches from remote)") + // } else { + // logInfo("EcallRecorder", "Initialized in %s mode (storing disabled)", mode) + // } return globalRecorder } @@ -198,11 +198,11 @@ func GetRecorder() *EcallRecorder { blockTraces: make(map[int64]*ExecutionTrace), } - if storeSGXData { - logInfo("EcallRecorder", "Initialized in %s mode with storing enabled, db dir: %s", mode, dbDir) - } else { - logInfo("EcallRecorder", "Initialized in %s mode, db dir: %s", mode, dbDir) - } + // if storeSGXData { + // logInfo("EcallRecorder", "Initialized in %s mode with storing enabled, db dir: %s", mode, dbDir) + // } else { + // logInfo("EcallRecorder", "Initialized in %s mode, db dir: %s", mode, dbDir) + // } return globalRecorder } @@ -333,9 +333,9 @@ func (r *EcallRecorder) RecordSubmitBlockSignatures(height int64, random []byte, } // Only log every 1000 blocks to reduce noise - if height%1000 == 0 { - logInfo("EcallRecorder", "Recorded SubmitBlockSignatures for height %d", height) - } + // if height%1000 == 0 { + // logInfo("EcallRecorder", "Recorded SubmitBlockSignatures for height %d", height) + // } return nil } @@ -360,9 +360,9 @@ func (r *EcallRecorder) ReplaySubmitBlockSignatures(height int64) (random []byte copy(evidence, value[32:]) // Only log every 1000 blocks to reduce noise - if height%1000 == 0 { - logInfo("EcallRecorder", "Replayed SubmitBlockSignatures for height %d", height) - } + // if height%1000 == 0 { + // logInfo("EcallRecorder", "Replayed SubmitBlockSignatures for height %d", height) + // } return random, evidence, true } @@ -392,7 +392,7 @@ func (r *EcallRecorder) RecordMachineIDProof(height int64, machineID []byte, pro return fmt.Errorf("failed to write machine ID proof to db: %w", err) } - logInfo("EcallRecorder", "Recorded MachineIDProof for height %d, machineID len=%d", height, len(machineID)) + // logInfo("EcallRecorder", "Recorded MachineIDProof for height %d, machineID len=%d", height, len(machineID)) return nil } @@ -411,7 +411,7 @@ func (r *EcallRecorder) ReplayMachineIDProof(height int64, machineID []byte) (pr return nil, false } - logInfo("EcallRecorder", "Replayed MachineIDProof for height %d (%d bytes)", height, len(value)) + // logInfo("EcallRecorder", "Replayed MachineIDProof for height %d (%d bytes)", height, len(value)) return value, true } @@ -447,7 +447,7 @@ func (r *EcallRecorder) RecordGetNetworkPubkey(height int64, iSeed uint32, nodeP return fmt.Errorf("failed to write network pubkey to db: %w", err) } - logInfo("EcallRecorder", "Recorded GetNetworkPubkey at height %d for i_seed %d", height, iSeed) + // logInfo("EcallRecorder", "Recorded GetNetworkPubkey at height %d for i_seed %d", height, iSeed) return nil } @@ -474,7 +474,7 @@ func (r *EcallRecorder) ReplayGetNetworkPubkey(height int64, iSeed uint32) (node ioPk = make([]byte, ioPkLen) copy(ioPk, value[offset+2:]) - logInfo("EcallRecorder", "Replayed GetNetworkPubkey at height %d for i_seed %d", height, iSeed) + // logInfo("EcallRecorder", "Replayed GetNetworkPubkey at height %d for i_seed %d", height, iSeed) return nodePk, ioPk, true } @@ -518,7 +518,7 @@ func (r *EcallRecorder) RecordGetEncryptedSeed(height int64, certHash []byte, ou return fmt.Errorf("failed to write to db: %w", err) } - logInfo("EcallRecorder", "Recorded GetEncryptedSeed success at height %d (%d bytes)", height, len(outp1)) + // logInfo("EcallRecorder", "Recorded GetEncryptedSeed success at height %d (%d bytes)", height, len(outp1)) return nil } @@ -537,7 +537,7 @@ func (r *EcallRecorder) RecordGetEncryptedSeedError(height int64, certHash []byt return fmt.Errorf("failed to write error to db: %w", err) } - logInfo("EcallRecorder", "Recorded GetEncryptedSeed error at height %d: %s", height, errMsg) + // logInfo("EcallRecorder", "Recorded GetEncryptedSeed error at height %d: %s", height, errMsg) return nil } @@ -555,7 +555,7 @@ func (r *EcallRecorder) ReplayGetEncryptedSeed(height int64, certHash []byte) (o errKey := makeSeedErrKey(height, certHash) errVal, err := r.db.Get(errKey) if err == nil && errVal != nil && len(errVal) > 0 { - logInfo("EcallRecorder", "Replayed GetEncryptedSeed error at height %d", height) + // logInfo("EcallRecorder", "Replayed GetEncryptedSeed error at height %d", height) return nil, nil, string(errVal), true } @@ -572,7 +572,7 @@ func (r *EcallRecorder) ReplayGetEncryptedSeed(height int64, certHash []byte) (o return nil, nil, "", false } - logInfo("EcallRecorder", "Replayed GetEncryptedSeed success at height %d (%d bytes)", height, len(outp1)) + // logInfo("EcallRecorder", "Replayed GetEncryptedSeed success at height %d (%d bytes)", height, len(outp1)) return outp1, outp2, "", true } @@ -850,7 +850,7 @@ func (r *EcallRecorder) DeleteRecordsBeforeHeight(height int64) error { } if count > 0 { - logInfo("EcallRecorder", "Pruned %d records before height %d", count, height) + // logInfo("EcallRecorder", "Pruned %d records before height %d", count, height) } return nil } @@ -938,7 +938,7 @@ func (r *EcallRecorder) RecordCreateResult(height int64, wasmHash []byte, codeHa return fmt.Errorf("failed to write Create result to db: %w", err) } - logInfo("EcallRecorder", "Recorded Create result for height %d, hasError=%v", height, result.HasError) + // logInfo("EcallRecorder", "Recorded Create result for height %d, hasError=%v", height, result.HasError) return nil } diff --git a/go-cosmwasm/api/lib.go b/go-cosmwasm/api/lib.go index 29c14b91fe..ef735b1b9b 100644 --- a/go-cosmwasm/api/lib.go +++ b/go-cosmwasm/api/lib.go @@ -78,7 +78,7 @@ func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom [ func SubmitValidatorSetEvidence(evidence []byte) error { recorder := GetRecorder() if recorder.IsReplayMode() { - logInfo("SubmitValidatorSetEvidence", "Skipped in replay mode") + // logInfo("SubmitValidatorSetEvidence", "Skipped in replay mode") return nil } errmsg := C.Buffer{} @@ -93,7 +93,7 @@ func InitBootstrap() ([]byte, error) { if recorder.IsReplayMode() { // In replay mode, return a dummy 32-byte public key // This function is only called during bootstrap which doesn't happen in replay - logInfo("InitBootstrap", "Skipped in replay mode") + // logInfo("InitBootstrap", "Skipped in replay mode") return make([]byte, 32), nil } errmsg := C.Buffer{} @@ -108,7 +108,7 @@ func LoadSeedToEnclave(masterKey []byte, seed []byte) (bool, error) { recorder := GetRecorder() if recorder.IsReplayMode() { // In replay mode, skip loading seed to enclave (no enclave) - logInfo("LoadSeedToEnclave", "Skipped in replay mode") + // logInfo("LoadSeedToEnclave", "Skipped in replay mode") return true, nil } pkSlice := sendSlice(masterKey) @@ -127,7 +127,7 @@ func LoadSeedToEnclave(masterKey []byte, seed []byte) (bool, error) { func RotateStore(kvs []byte) (bool, error) { recorder := GetRecorder() if recorder.IsReplayMode() { - logInfo("RotateStore", "Skipped in replay mode") + // logInfo("RotateStore", "Skipped in replay mode") return false, errors.New("rotate store not supported on non-SGX node") } // avoid buffer copy. We need modification in-place @@ -150,7 +150,7 @@ func RotateStore(kvs []byte) (bool, error) { func MigrationOp(op uint32) (bool, error) { recorder := GetRecorder() if recorder.IsReplayMode() { - logInfo("MigrationOp", "Skipped in replay mode") + // logInfo("MigrationOp", "Skipped in replay mode") return true, nil // no-op success so upgrade handlers don't fail } ret, err := C.migration_op(u32(op)) @@ -229,7 +229,7 @@ func InitEnclaveRuntime(moduleCacheSize uint16) error { recorder := GetRecorder() if recorder.IsReplayMode() { // In replay mode, skip enclave runtime initialization (no enclave) - logInfo("InitEnclaveRuntime", "Skipped in replay mode") + // logInfo("InitEnclaveRuntime", "Skipped in replay mode") return nil } @@ -249,7 +249,7 @@ func InitEnclaveRuntime(moduleCacheSize uint16) error { func OnUpgradeProposalPassed(mrEnclaveHash []byte) error { recorder := GetRecorder() if recorder.IsReplayMode() { - logInfo("OnUpgradeProposalPassed", "Skipped in replay mode") + // logInfo("OnUpgradeProposalPassed", "Skipped in replay mode") return nil } msgBuf := sendSlice(mrEnclaveHash) @@ -287,7 +287,7 @@ func OnApproveMachineID(machineID []byte) error { if recErr := recorder.RecordMachineIDProof(height, []byte(machineIDHex), []byte{add_result}); recErr != nil { logError("OnApproveMachineID", "Failed to record machine ID proof for replay: %v", recErr) } else { - logInfo("OnApproveMachineID", "Recorded MachineIDProof for %s at height %d", machineIDHex, height) + // logInfo("OnApproveMachineID", "Recorded MachineIDProof for %s at height %d", machineIDHex, height) } } @@ -906,7 +906,7 @@ func KeyGen() ([]byte, error) { if recorder.IsReplayMode() { // In replay mode, return a dummy 32-byte public key // Key generation is only needed for node registration which doesn't happen in replay - logInfo("KeyGen", "Skipped in replay mode, returning dummy key") + // logInfo("KeyGen", "Skipped in replay mode, returning dummy key") return make([]byte, 32), nil } @@ -923,7 +923,7 @@ func CreateAttestationReport(ext_sk []byte, is_migration_report bool) (bool, err recorder := GetRecorder() if recorder.IsReplayMode() { // In replay mode, skip attestation report creation (no SGX) - logInfo("CreateAttestationReport", "Skipped in replay mode") + // logInfo("CreateAttestationReport", "Skipped in replay mode") return true, nil } errmsg := C.Buffer{} @@ -948,8 +948,8 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e certHash := sha256.Sum256(cert) certHashHex := hex.EncodeToString(certHash[:]) - logInfo("GetEncryptedSeed", "SGX called: certHashHex=%s certLen=%d replayMode=%v", - certHashHex, len(cert), recorder.IsReplayMode()) + // logInfo("GetEncryptedSeed", "SGX called: certHashHex=%s certLen=%d replayMode=%v", + // certHashHex, len(cert), recorder.IsReplayMode()) if recorder.IsReplayMode() { // Try local DB first @@ -985,7 +985,7 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e res, err := C.get_encrypted_seed(certSlice, replace_machine_slice, &errmsg) if err != nil { enclaveErr := errorWithMessage(err, errmsg) - logInfo("GetEncryptedSeed", "SGX enclave FAILED for %s: %v", certHashHex, enclaveErr) + // logInfo("GetEncryptedSeed", "SGX enclave FAILED for %s: %v", certHashHex, enclaveErr) // Record the error so non-SGX nodes can replay the exact same message height := recorder.GetCurrentBlockHeight() if recErr := recorder.RecordGetEncryptedSeedError(height, certHash[:], enclaveErr.Error()); recErr != nil { @@ -997,11 +997,11 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e output1 := receiveVector(res.buf1) output2 := receiveVector(res.buf2) height := recorder.GetCurrentBlockHeight() - logInfo("GetEncryptedSeed", "SGX enclave SUCCESS for %s (%d bytes), recording at height %d...", certHashHex, len(output1), height) + // logInfo("GetEncryptedSeed", "SGX enclave SUCCESS for %s (%d bytes), recording at height %d...", certHashHex, len(output1), height) if err := recorder.RecordGetEncryptedSeed(height, certHash[:], output1, output2); err != nil { logError("GetEncryptedSeed", "Failed to record: %v", err) } else { - logInfo("GetEncryptedSeed", "Recorded GetEncryptedSeed for %s OK", certHashHex) + // logInfo("GetEncryptedSeed", "Recorded GetEncryptedSeed for %s OK", certHashHex) } return output1, output2, nil } diff --git a/go-cosmwasm/api/lib_nosgx.go b/go-cosmwasm/api/lib_nosgx.go index 75902404cf..9137e27822 100644 --- a/go-cosmwasm/api/lib_nosgx.go +++ b/go-cosmwasm/api/lib_nosgx.go @@ -32,7 +32,7 @@ func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom [ } func SubmitValidatorSetEvidence(evidence []byte) error { - logInfo("SubmitValidatorSetEvidence", "Skipped in replay mode") + //logInfo("SubmitValidatorSetEvidence", "Skipped in replay mode") return nil } @@ -43,7 +43,7 @@ func LoadSeedToEnclave(masterKey []byte, seed []byte) (bool, error) { type Querier = types.Querier func MigrationOp(op uint32) (bool, error) { - logInfo("MigrationOp", "Skipped in replay mode") + //logInfo("MigrationOp", "Skipped in replay mode") return true, nil // no-op success so upgrade handlers don't fail } @@ -94,7 +94,7 @@ func Create(cache Cache, wasm []byte) ([]byte, error) { for i, fetchedHash := range wasmHashes { if bytes.Equal(fetchedHash, wasmHash[:]) { r := results[i] - logInfo("Create", "Matched Create result from SGX node: height=%d hasError=%v (attempt %d)", height, r.HasError, attempt+1) + //logInfo("Create", "Matched Create result from SGX node: height=%d hasError=%v (attempt %d)", height, r.HasError, attempt+1) if r.HasError { return nil, fmt.Errorf("%s", r.ErrorMsg) } @@ -276,12 +276,12 @@ func AnalyzeCode( } func KeyGen() ([]byte, error) { - logInfo("KeyGen", "Skipped in replay mode, returning dummy key") + //logInfo("KeyGen", "Skipped in replay mode, returning dummy key") return make([]byte, 32), nil } func CreateAttestationReport(ext_sk []byte, is_migration_report bool) (bool, error) { - logInfo("CreateAttestationReport", "Skipped in replay mode") + //logInfo("CreateAttestationReport", "Skipped in replay mode") return true, nil } @@ -302,21 +302,21 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e certHash := sha256.Sum256(cert) certHashHex := hex.EncodeToString(certHash[:]) - logInfo("GetEncryptedSeed", "NON-SGX called: certHashHex=%s certLen=%d dbInitialized=%v", - certHashHex, len(cert), recorder != nil && recorder.db != nil) + //logInfo("GetEncryptedSeed", "NON-SGX called: certHashHex=%s certLen=%d dbInitialized=%v", + // certHashHex, len(cert), recorder != nil && recorder.db != nil) height := recorder.GetCurrentBlockHeight() // Try local DB first if outp1, outp2, errMsg, found := recorder.ReplayGetEncryptedSeed(height, certHash[:]); found { if errMsg != "" { - logInfo("GetEncryptedSeed", "Found CACHED ERROR in local DB for %s: %s", certHashHex, errMsg) + //logInfo("GetEncryptedSeed", "Found CACHED ERROR in local DB for %s: %s", certHashHex, errMsg) return nil, nil, fmt.Errorf("%s", errMsg) } - logInfo("GetEncryptedSeed", "Found CACHED SUCCESS in local DB for %s (%d bytes)", certHashHex, len(outp1)) + //logInfo("GetEncryptedSeed", "Found CACHED SUCCESS in local DB for %s (%d bytes)", certHashHex, len(outp1)) return outp1, outp2, nil } - logInfo("GetEncryptedSeed", "NOT in local DB for %s, will fetch from SGX node via gRPC", certHashHex) + //logInfo("GetEncryptedSeed", "NOT in local DB for %s, will fetch from SGX node via gRPC", certHashHex) // Fetch from remote SGX node with retries (the SGX node may still be // processing the same block and recording the seed when we query) @@ -329,7 +329,7 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e for attempt := 0; attempt < maxRetries; attempt++ { outp1, outp2, err := client.FetchEncryptedSeed(height, certHashHex) if err == nil { - logInfo("GetEncryptedSeed", "Fetched seed from SGX node (attempt %d) for %s (%d bytes)", + //logInfo("GetEncryptedSeed", "Fetched seed from SGX node (attempt %d) for %s (%d bytes)", attempt+1, certHashHex, len(outp1)) // Cache locally if cacheErr := recorder.RecordGetEncryptedSeed(height, certHash[:], outp1, outp2); cacheErr != nil { @@ -346,14 +346,14 @@ func GetEncryptedSeed(cert []byte, replace_machine_id []byte) ([]byte, []byte, e grpcMsg = st.Message() } - logInfo("GetEncryptedSeed", "gRPC attempt %d/%d for %s: code=%s msg=%s", + //logInfo("GetEncryptedSeed", "gRPC attempt %d/%d for %s: code=%s msg=%s", attempt+1, maxRetries, certHashHex, grpcCode, grpcMsg) // Check if this is a FailedPrecondition error (recorded error from SGX node) if st, ok := status.FromError(err); ok && st.Code() == codes.FailedPrecondition { // The SGX node recorded the enclave error - cache and replay it enclaveErrMsg := st.Message() - logInfo("GetEncryptedSeed", "SGX node returned FailedPrecondition (enclave error) for %s: %s", + //logInfo("GetEncryptedSeed", "SGX node returned FailedPrecondition (enclave error) for %s: %s", certHashHex, enclaveErrMsg) if cacheErr := recorder.RecordGetEncryptedSeedError(height, certHash[:], enclaveErrMsg); cacheErr != nil { logError("GetEncryptedSeed", "Failed to cache error: %v", cacheErr) @@ -407,7 +407,7 @@ func OnApproveMachineID(machineID []byte) error { // On SGX nodes this loads them into the enclave; on non-SGX there's // no enclave, so just skip — the proof already lives in the KV store. if height == 0 { - logInfo("OnApproveMachineID", "Skipping at init (height=0, no enclave on non-SGX)") + //logInfo("OnApproveMachineID", "Skipping at init (height=0, no enclave on non-SGX)") return nil } @@ -419,7 +419,7 @@ func OnApproveMachineID(machineID []byte) error { for { data, err := client.FetchMachineIDProof(height, machineIDHex) if err == nil && len(data) > 0 { - logInfo("OnApproveMachineID", "Fetched proof from SGX node: height=%d (attempt %d)", height, attempt+1) + //logInfo("OnApproveMachineID", "Fetched proof from SGX node: height=%d (attempt %d)", height, attempt+1) if data[0] != 0 { return nil From 251c57c4fe75dece3ad94cbd0f15162796d351a1 Mon Sep 17 00:00:00 2001 From: vlad Date: Sun, 17 May 2026 21:59:07 +0000 Subject: [PATCH 43/55] allow_list: machine replace logic fix --- .../execute/src/registration/attestation.rs | 21 +++++++---- .../execute/src/registration/onchain.rs | 36 ++++++++++--------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index 925b59a667..757692176f 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -167,7 +167,7 @@ pub mod allow_list { }; if x == owner { - return false; // no error, just no effect + return true; // no effect, skip the rest } *x = *owner; // replace the owner of @@ -490,6 +490,7 @@ pub struct AttestationCombined { pub quote: Vec, pub coll: Vec, pub jwt_token: Vec, + pub use_machine_id: Option, } impl AttestationCombined { @@ -498,6 +499,7 @@ impl AttestationCombined { quote: Vec::new(), coll: Vec::new(), jwt_token: Vec::new(), + use_machine_id: None, }; if (blob_len > 0) && (unsafe { *blob_ptr } != 0) { @@ -845,17 +847,23 @@ pub fn verify_quote_sgx( return Err(sgx_status_t::SGX_ERROR_UNEXPECTED); } + let mut machine_id_to_check = attestation.use_machine_id; + let machine_id_opt = if let Some(ppid) = attestation.extract_cpu_cert() { - Some(crate::registration::offchain::calculate_truncated_hash( - &ppid, - )) + let hash = crate::registration::offchain::calculate_truncated_hash(&ppid); + println!("Machine ID: {}", orig_hex::encode(&hash)); + + if machine_id_to_check == None { + machine_id_to_check = Some(hash); + } + + Some(hash) } else { None }; - let is_in_wl = match &machine_id_opt { + let is_in_wl = match &machine_id_to_check { Some(machine_id_hash) => { - println!("Machine ID: {}", orig_hex::encode(machine_id_hash)); let wl = PPID_WHITELIST.lock().unwrap(); wl.m_to_o.contains_key(machine_id_hash) } @@ -1017,6 +1025,7 @@ pub fn get_quote_ecdsa_untested(pub_k: &[u8]) -> Result res, Err(e) => { @@ -181,22 +189,18 @@ pub unsafe extern "C" fn ecall_authenticate_new_node( let owner: &allow_list::Owner = &verified_quote.body.report_data.d[32..].try_into().unwrap(); - let machine_pop: &allow_list::MachineID = - slice::from_raw_parts(p_machine_pop, allow_list::MACHINE_ID_LEN) - .try_into() - .unwrap(); - - // if swap-res failed - never mind. This is probably because the machine was added with proof-of-cloud - if allow_list.update(&machine_id_hash, owner, machine_pop) { - slice::from_raw_parts_mut(p_machine_info, allow_list::OWNER_LEN) - .copy_from_slice(owner); - - slice::from_raw_parts_mut( - p_machine_info.add(allow_list::OWNER_LEN), - allow_list::MACHINE_ID_LEN, - ) - .copy_from_slice(&machine_id_hash); + if !allow_list.update(&machine_id_hash, owner, machine_pop) { + return NodeAuthResult::InvalidCert; } + + slice::from_raw_parts_mut(p_machine_info, allow_list::OWNER_LEN) + .copy_from_slice(owner); + + slice::from_raw_parts_mut( + p_machine_info.add(allow_list::OWNER_LEN), + allow_list::MACHINE_ID_LEN, + ) + .copy_from_slice(&machine_id_hash); } slice::from_raw_parts_mut(p_seeds, res.len()).copy_from_slice(&res); From c2db36f14321a3aa828ee4e691aee347c4e03134 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 18 May 2026 12:57:41 +0000 Subject: [PATCH 44/55] cosmetic --- cosmwasm/enclaves/execute/src/registration/attestation.rs | 2 +- cosmwasm/enclaves/execute/src/registration/offchain.rs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index 757692176f..abf7221611 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -175,7 +175,7 @@ pub mod allow_list { if let Some(x) = self.m_to_o.get(machine_pop) { if *x != *owner { error!( - "unknown machine {} not owned by this actor", + "machine {} not owned by this actor", hex::encode(machine_pop) ); return false; diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index f053fd9157..f6193022be 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -982,8 +982,6 @@ pub unsafe extern "C" fn ecall_submit_machine_swap( extra.apphash }; - //println!("expected apphash: {}", hex::encode(&apphash)); - let mut merkle = MerkleProcessor::new(slice::from_raw_parts(p_proof, n_proof as usize)); let proof_parts = Keychain::read_u32(&mut merkle.cursor)?; @@ -1015,6 +1013,11 @@ pub unsafe extern "C" fn ecall_submit_machine_swap( merkle.interpret_sub_path(&mut hash_val)?; if apphash != hash_val { + error!( + "Merkle root expected: {}, actual: {}", + hex::encode(&apphash), + hex::encode(&hash_val) + ); return Err(io::Error::new( io::ErrorKind::InvalidData, "apphash mismatch", From 5fbd53162f412fc10d4664213a37fd321629de2b Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 18 May 2026 12:59:01 +0000 Subject: [PATCH 45/55] adjusted point to submit machine ids with proofs --- x/compute/internal/keeper/keeper.go | 6 ++---- x/compute/internal/keeper/msg_server.go | 2 +- x/compute/module.go | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x/compute/internal/keeper/keeper.go b/x/compute/internal/keeper/keeper.go index 1ac4471a00..a4bdd91081 100644 --- a/x/compute/internal/keeper/keeper.go +++ b/x/compute/internal/keeper/keeper.go @@ -85,7 +85,7 @@ type Keeper struct { bankKeeper bankkeeper.Keeper portKeeper portkeeper.Keeper capabilityKeeper capabilitykeeper.ScopedKeeper - regKeeper *registration.Keeper + RegKeeper *registration.Keeper cronKeeper cronkeeper.Keeper wasmer wasm.Wasmer queryPlugins QueryPlugins @@ -161,7 +161,7 @@ func NewKeeper( cronKeeper: cronKeeper, portKeeper: portKeeper, capabilityKeeper: capabilityKeeper, - regKeeper: regKeeper, + RegKeeper: regKeeper, messenger: NewMessageHandler( msgRouter, customEncoders, @@ -1188,8 +1188,6 @@ func (k Keeper) SetRandomSeed(ctx sdk.Context, random []byte, validator_set_evid if err != nil { ctx.Logger().Error("SetRandomSeed:", err.Error()) } - - k.regKeeper.MaybeSetEnclaveColdData(ctx) } func (k Keeper) GetContractAddress(ctx sdk.Context, label string) sdk.AccAddress { diff --git a/x/compute/internal/keeper/msg_server.go b/x/compute/internal/keeper/msg_server.go index 4fbc293586..2d0be39f6f 100644 --- a/x/compute/internal/keeper/msg_server.go +++ b/x/compute/internal/keeper/msg_server.go @@ -385,7 +385,7 @@ func (m msgServer) UpdateMachineWhitelist(goCtx context.Context, msg *types.MsgU fmt.Println("Failed to add machine_id: ", id_txt) } else { fmt.Println("Added machine_id: ", id_txt) - _ = m.keeper.regKeeper.OnNewMachine(ctx, id) + _ = m.keeper.RegKeeper.OnNewMachine(ctx, id) } } diff --git a/x/compute/module.go b/x/compute/module.go index b27f9c5d1b..5850a7b338 100644 --- a/x/compute/module.go +++ b/x/compute/module.go @@ -231,6 +231,8 @@ func (am AppModule) BeginBlock(c context.Context) error { return err } + am.keeper.RegKeeper.MaybeSetEnclaveColdData(ctx) + // Record the result for non-SGX nodes if err := recorder.RecordSubmitBlockSignatures(height, random, validator_set_evidence); err != nil { ctx.Logger().Error("Failed to record SubmitBlockSignatures", "error", err) From 16fc42bbd7a4a18691de6da438caad51034f7721 Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 18 May 2026 12:59:51 +0000 Subject: [PATCH 46/55] changed machine allow/disallow logic. (Responding only to disallow) --- .../src/submit_block_signatures.rs | 6 +++--- .../enclaves/shared/utils/src/key_manager.rs | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs index 8b23e13ec7..9e070a77f1 100644 --- a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs +++ b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs @@ -63,10 +63,10 @@ pub unsafe fn submit_block_signatures_impl( let (validator_set, height) = { let mut extra = KEY_MANAGER.extra_data.lock().unwrap(); - if extra.last_submitted_header_height == 0 { - extra.last_submitted_header_height = extra.height; + if extra.machine_allowed { + extra.height_machine_allowed = extra.height; } else { - if (extra.last_submitted_header_height != extra.height) && !extra.machine_allowed { + if (extra.height_machine_allowed > 0) && (extra.height_machine_allowed < extra.height) { error!("This machine isn't allowed to run"); return sgx_status_t::SGX_ERROR_INVALID_PARAMETER; } diff --git a/cosmwasm/enclaves/shared/utils/src/key_manager.rs b/cosmwasm/enclaves/shared/utils/src/key_manager.rs index 949ac48504..f7fd738e6e 100644 --- a/cosmwasm/enclaves/shared/utils/src/key_manager.rs +++ b/cosmwasm/enclaves/shared/utils/src/key_manager.rs @@ -43,8 +43,8 @@ pub struct KeychainMutableData { pub validator_set_serialized: Vec, pub next_mr_enclave: Option, pub last_block_seed: u16, + pub height_machine_allowed: u64, // the following is NOT serialized - pub last_submitted_header_height: u64, pub machine_allowed: bool, } @@ -136,6 +136,10 @@ impl Keychain { 4_u8 } else { 0_u8 + }) | (if extra.height_machine_allowed != 0 { + 8_u8 + } else { + 0_u8 }); writer.write_all(&[ex_flag])?; @@ -152,6 +156,10 @@ impl Keychain { writer.write_all(&extra.apphash)?; } + if ex_flag & 8_u8 != 0 { + writer.write_all(&extra.height_machine_allowed.to_le_bytes())?; + } + Ok(()) } @@ -238,6 +246,12 @@ impl Keychain { extra.apphash = [0u8; 32]; } + if (flag_bytes[0] & 8_u8) != 0 { + extra.height_machine_allowed = Self::read_u64(reader)?; + } else { + extra.height_machine_allowed = 0; + } + Ok(()) } @@ -305,7 +319,7 @@ impl Keychain { validator_set_serialized: Vec::new(), next_mr_enclave: None, last_block_seed: DEF_LAST_BLOCK_SEED, - last_submitted_header_height: 0, + height_machine_allowed: 0, machine_allowed: false, }), } From c55693b55ad2efd60c37ec23b0dfcd74a66382e4 Mon Sep 17 00:00:00 2001 From: vlad Date: Wed, 20 May 2026 08:33:45 +0000 Subject: [PATCH 47/55] cold machine data submit fix --- cosmwasm/enclaves/execute/src/registration/offchain.rs | 2 +- .../block-verifier/src/submit_block_signatures.rs | 10 ++++++++-- x/registration/internal/keeper/keeper.go | 5 +++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index f6193022be..00790e35db 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -996,7 +996,7 @@ pub unsafe extern "C" fn ecall_submit_machine_swap( let mut hash_val = { let mut k = [0u8; 5]; k[0] = 0x03; // RegistrationMachinePrefix - k[1..5].copy_from_slice(&index.to_le_bytes()); + k[1..5].copy_from_slice(&index.to_be_bytes()); let v = slice::from_raw_parts(p_machine_info, n_machine_info as usize); diff --git a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs index 9e070a77f1..225e62e07b 100644 --- a/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs +++ b/cosmwasm/enclaves/shared/block-verifier/src/submit_block_signatures.rs @@ -66,8 +66,14 @@ pub unsafe fn submit_block_signatures_impl( if extra.machine_allowed { extra.height_machine_allowed = extra.height; } else { - if (extra.height_machine_allowed > 0) && (extra.height_machine_allowed < extra.height) { - error!("This machine isn't allowed to run"); + // allow the machine to work even if initially disallowed. Stop it only after it was allowed on-chain, and then disallowed + if (extra.height_machine_allowed > 0) + && (extra.height_machine_allowed + 1 < extra.height) + { + error!( + "This machine isn't allowed to run. Last allowed_height={}, current_height={}", + extra.height_machine_allowed, extra.height + ); return sgx_status_t::SGX_ERROR_INVALID_PARAMETER; } } diff --git a/x/registration/internal/keeper/keeper.go b/x/registration/internal/keeper/keeper.go index abeed81678..61ede102f1 100644 --- a/x/registration/internal/keeper/keeper.go +++ b/x/registration/internal/keeper/keeper.go @@ -278,6 +278,9 @@ func (k *Keeper) MaybeSetEnclaveColdData(ctx sdk.Context) error { k.coldDataSet = true + height := ctx.BlockHeight() - 1 + // fmt.Println("**** Submitting cold data to enclave, for height=", height) + // on-chain approved machine migrations store := k.storeService.OpenKVStore(ctx) @@ -298,8 +301,6 @@ func (k *Keeper) MaybeSetEnclaveColdData(ctx sdk.Context) error { // fmt.Println("Querying the enclave cold evidence") - height := ctx.BlockHeight() - 1 - key = append(types.RegistrationMachinePrefix, key...) req := &abci.RequestQuery{ Path: "/store/register/key", // <- your module storeKey From f947def9f730f94a5570f394662d4f7d9bea19b5 Mon Sep 17 00:00:00 2001 From: vlad Date: Wed, 20 May 2026 08:37:02 +0000 Subject: [PATCH 48/55] fixed error msgs --- cosmwasm/enclaves/execute/src/registration/attestation.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index abf7221611..276a078ec9 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -175,8 +175,9 @@ pub mod allow_list { if let Some(x) = self.m_to_o.get(machine_pop) { if *x != *owner { error!( - "machine {} not owned by this actor", - hex::encode(machine_pop) + "Failed to replace MachineID - machine {} not owned by validator key {}", + hex::encode(machine_pop), + hex::encode(owner) ); return false; } @@ -884,7 +885,7 @@ pub fn verify_quote_sgx( }; if check_ppid_wl && (!is_in_wl && !jwt_token_valid) { - println!("Unknown Machine, JWT token not provided"); + println!("This machine is not known, and doesn't present a valid JWT token. The machine cannot join the network."); return Err(sgx_status_t::SGX_ERROR_UNEXPECTED); } From 0d3bfed6a418a94686ee2cefdf7a49a973af1cb2 Mon Sep 17 00:00:00 2001 From: vlad Date: Wed, 20 May 2026 08:56:34 +0000 Subject: [PATCH 49/55] tx register: added explicit --replace-machine-id flag --- x/registration/client/cli/tx.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/x/registration/client/cli/tx.go b/x/registration/client/cli/tx.go index 643f1e939d..3c0870f6f5 100644 --- a/x/registration/client/cli/tx.go +++ b/x/registration/client/cli/tx.go @@ -28,10 +28,11 @@ func GetTxCmd() *cobra.Command { // AuthenticateNodeCmd will upload code to be reused. func AuthenticateNodeCmd() *cobra.Command { + var replaceMachineID string cmd := &cobra.Command{ - Use: "auth attestation_file [replace_machine_id]", + Use: "auth attestation_file [--replace-machine-id machine_id]", Short: "Upload a certificate to authenticate the node", - Args: cobra.RangeArgs(1, 2), + Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { // clientCtx := client.GetClientContextFromCmd(cmd) clientCtx, err := client.GetClientTxContext(cmd) @@ -44,17 +45,11 @@ func AuthenticateNodeCmd() *cobra.Command { return err } - replace_machine_id := "" - - if len(args) > 1 { - replace_machine_id = args[1] - } - // build and sign the transaction, then broadcast to Tendermint msg := types.RaAuthenticate{ Sender: clientCtx.GetFromAddress(), Certificate: cert, - ReplaceMachineId: replace_machine_id, + ReplaceMachineId: replaceMachineID, } err = msg.ValidateBasic() if err != nil { @@ -65,5 +60,12 @@ func AuthenticateNodeCmd() *cobra.Command { } flags.AddTxFlagsToCmd(cmd) + cmd.Flags().StringVar( + &replaceMachineID, + "replace-machine-id", + "", + "machine to replace", + ) + return cmd } From 73767356093b7ac980ce3e5b1fba7ec5fcfecb4f Mon Sep 17 00:00:00 2001 From: vlad Date: Wed, 20 May 2026 10:23:01 +0000 Subject: [PATCH 50/55] build fix --- cosmwasm/enclaves/execute/src/registration/report.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cosmwasm/enclaves/execute/src/registration/report.rs b/cosmwasm/enclaves/execute/src/registration/report.rs index f0c7e83767..e4dd763264 100644 --- a/cosmwasm/enclaves/execute/src/registration/report.rs +++ b/cosmwasm/enclaves/execute/src/registration/report.rs @@ -727,6 +727,7 @@ pub mod tests { quote: vec_quote, coll: vec_coll, jwt_token: Vec::new(), + use_machine_id: None, }; let res = verify_quote_sgx(&attestation, time_s, false); @@ -748,6 +749,7 @@ pub mod tests { quote: vec_quote, coll: vec_coll, jwt_token: Vec::new(), + use_machine_id: None, }; let res = verify_quote_sgx(&attestation, time_s, false); From aefb26e8f84c7f424a72cc7a68a742f13ce00764 Mon Sep 17 00:00:00 2001 From: vlad Date: Wed, 20 May 2026 13:32:26 +0000 Subject: [PATCH 51/55] clippy fixes --- .../enclaves/execute/src/registration/attestation.rs | 10 +++++----- .../execute/src/registration/check_patch_level.rs | 2 +- cosmwasm/enclaves/execute/src/registration/offchain.rs | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cosmwasm/enclaves/execute/src/registration/attestation.rs b/cosmwasm/enclaves/execute/src/registration/attestation.rs index 276a078ec9..c323bda3c3 100644 --- a/cosmwasm/enclaves/execute/src/registration/attestation.rs +++ b/cosmwasm/enclaves/execute/src/registration/attestation.rs @@ -448,8 +448,8 @@ lazy_static::lazy_static! { pub static ref SELF_MACHINE_ID: Option = { let ppid = SELF_QUOTE_PPID.as_ref()?; - let machine_id = crate::registration::offchain::calculate_truncated_hash(&ppid); - trace!("Self machine_id = {}", hex::encode(&machine_id)); + let machine_id = crate::registration::offchain::calculate_truncated_hash(ppid); + trace!("Self machine_id = {}", hex::encode(machine_id)); Some(machine_id) }; @@ -852,9 +852,9 @@ pub fn verify_quote_sgx( let machine_id_opt = if let Some(ppid) = attestation.extract_cpu_cert() { let hash = crate::registration::offchain::calculate_truncated_hash(&ppid); - println!("Machine ID: {}", orig_hex::encode(&hash)); + println!("Machine ID: {}", orig_hex::encode(hash)); - if machine_id_to_check == None { + if machine_id_to_check.is_none() { machine_id_to_check = Some(hash); } @@ -891,7 +891,7 @@ pub fn verify_quote_sgx( Ok(VerifiedSgxQuote { body: (*my_p_quote).report_body, - qv_result: qv_result, + qv_result, machine_id_hash: machine_id_opt, }) } diff --git a/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs b/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs index 5d4761a264..d8c8dccda5 100644 --- a/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs +++ b/cosmwasm/enclaves/execute/src/registration/check_patch_level.rs @@ -41,7 +41,7 @@ pub unsafe extern "C" fn ecall_check_patch_level( unsafe fn check_patch_level_dcap() -> NodeAuthResult { match &*SELF_QUOTE_UNTESTED { Ok(attestation) => { - match verify_quote_sgx(&attestation, 0, false) { + match verify_quote_sgx(attestation, 0, false) { Ok(res) => { if res.qv_result != sgx_ql_qv_result_t::SGX_QL_QV_RESULT_OK { println!("WARNING: {}", res.qv_result); diff --git a/cosmwasm/enclaves/execute/src/registration/offchain.rs b/cosmwasm/enclaves/execute/src/registration/offchain.rs index 00790e35db..558babb543 100644 --- a/cosmwasm/enclaves/execute/src/registration/offchain.rs +++ b/cosmwasm/enclaves/execute/src/registration/offchain.rs @@ -381,7 +381,7 @@ pub unsafe extern "C" fn ecall_get_attestation_report( }; let attestation = { - let pk_len = 32 as usize; + let pk_len = 32_usize; report_data[0..pk_len].copy_from_slice(&kp.get_pubkey()); if n_sk == 32 { @@ -933,7 +933,7 @@ impl<'a> MerkleProcessor<'a> { Self::hash_var_uint(&mut hasher, key.len()); hasher.update(key); Self::hash_var_uint(&mut hasher, valhash.len()); - hasher.update(&valhash); + hasher.update(valhash); Ok(hasher.finalize().into()) } @@ -1015,8 +1015,8 @@ pub unsafe extern "C" fn ecall_submit_machine_swap( if apphash != hash_val { error!( "Merkle root expected: {}, actual: {}", - hex::encode(&apphash), - hex::encode(&hash_val) + hex::encode(apphash), + hex::encode(hash_val) ); return Err(io::Error::new( io::ErrorKind::InvalidData, From e7aa8649092780cab98c69d7dccef7d7e2ca2c23 Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 21 May 2026 06:30:33 +0000 Subject: [PATCH 52/55] build fix --- x/registration/internal/keeper/keeper_test.go | 2 +- x/registration/internal/types/msg_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/x/registration/internal/keeper/keeper_test.go b/x/registration/internal/keeper/keeper_test.go index a65b5bfff4..ae660ab176 100644 --- a/x/registration/internal/keeper/keeper_test.go +++ b/x/registration/internal/keeper/keeper_test.go @@ -87,6 +87,6 @@ func TestKeeper_RegisterNode(t *testing.T) { regKeeper.SetRegistrationInfo(ctx, regInfo) - _, err = regKeeper.RegisterNode(ctx, cert) + _, err = regKeeper.RegisterNode(ctx, cert, "") require.NoError(t, err) } diff --git a/x/registration/internal/types/msg_test.go b/x/registration/internal/types/msg_test.go index 9cc6f571de..d6bbe92b63 100644 --- a/x/registration/internal/types/msg_test.go +++ b/x/registration/internal/types/msg_test.go @@ -18,6 +18,7 @@ func TestMsgRaAuthenticateRoute(t *testing.T) { msg := RaAuthenticate{ addr1, cert, + "", } require.Equal(t, msg.Route(), RouterKey) @@ -46,15 +47,18 @@ func TestMsgSendValidation(t *testing.T) { {true, RaAuthenticate{ addr0, cert, + "", }}, // invalid address send {false, RaAuthenticate{ addr0, invalidCert, + "", }}, // malformed certificate {false, RaAuthenticate{ addr0, certBadSig, + "", }}, // certificate with a bad signature } @@ -77,6 +81,7 @@ func TestMsgSendGetSignBytes(t *testing.T) { msg := RaAuthenticate{ addr0, cert, + "", } res := msg.GetSignBytes() expected := `{"ra_cert":"MIIBkzCCATmgAwIBAgIBATAKBggqhkjOPQQDAjAUMRIwEAYDVQQDDAlFbmlnbWFURUUwHhcNMjAwNTI1MDc1MzM0WhcNMjAwODIzMDc1MzM0WjAnMSUwIwYDVQQDDBxFbmlnbWFDaGFpbiBOb2RlIENlcnRpZmljYXRlMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeG13Xxb1oWAqeBSahnmi8rEQH5Q3pGa+knDNikM7AIels1eqEpEebKV8RDxRlb4EdmAHPtxp5xVB6pDI/vh7wKNpMGcwZQYJYIZIAYb4QgENBFgwSEdyb3FpMjhIcFM1aFhNODNzZDZrL2lJbGdjckZjM3IrTmpHa2R3VU16ZEJCQnFZKzd5ZXg4c2V1eERaeG9lb1JmS0l6R0xZMDMrVVdrZzl2K3V5UT09MAoGCCqGSM49BAMCA0gAMEUCIFCpcWt77lCX+I8WpuRpkGdHYSp/KeCM5lEbfkls/VolAiEAulO7Btux2jcE8QP3Mo9/7cGm/BykxZxAbJIjO9AqLHY=","sender":"cosmos1w9mkcmnd0p4rwurjwpursunewdux6vn4d4tp6g"}` @@ -92,6 +97,7 @@ func TestMsgSendGetSigners(t *testing.T) { msg := RaAuthenticate{ addr0, cert, + "", } res := msg.GetSigners() require.Equal(t, fmt.Sprintf("%v", res), "[71776C6E6D786A377072707838727973786D3275]") From dbe5fa4e3959476bfca9cc275b076fae2deae5b0 Mon Sep 17 00:00:00 2001 From: vlad Date: Thu, 21 May 2026 06:54:47 +0000 Subject: [PATCH 53/55] build fix (2) --- x/registration/internal/keeper/keeper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/registration/internal/keeper/keeper.go b/x/registration/internal/keeper/keeper.go index 61ede102f1..56bcd23513 100644 --- a/x/registration/internal/keeper/keeper.go +++ b/x/registration/internal/keeper/keeper.go @@ -264,7 +264,7 @@ func SerializeMerkleProof(ops []cmtcrypto.ProofOp) (error, []byte) { } default: - return fmt.Errorf("unknown ICS23 proof type in CommitmentProof: %w", p), nil + return fmt.Errorf("unknown ICS23 proof type in CommitmentProof: %v", p), nil } } From 7422b9b68431b5c2a9d748134480112b0c520eda Mon Sep 17 00:00:00 2001 From: vlad Date: Fri, 22 May 2026 13:59:39 +0000 Subject: [PATCH 54/55] build fix (3) --- x/compute/internal/keeper/keeper_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/compute/internal/keeper/keeper_test.go b/x/compute/internal/keeper/keeper_test.go index 14f1b54a6e..27f4a23fe2 100644 --- a/x/compute/internal/keeper/keeper_test.go +++ b/x/compute/internal/keeper/keeper_test.go @@ -39,7 +39,7 @@ func init() { config.SetBech32PrefixForConsensusNode(eng.Bech32PrefixConsAddr, eng.Bech32PrefixConsPub) config.Seal() - _, err = api.InitBootstrap() + _, err := api.InitBootstrap() if err != nil { panic(fmt.Sprintf("Error initializing the enclave: %v", err)) } From efc2c0aa63e867b48fbb8bcbd0831c25dc49cae1 Mon Sep 17 00:00:00 2001 From: vlad Date: Fri, 22 May 2026 16:25:37 +0000 Subject: [PATCH 55/55] build fix (4) --- x/compute/internal/keeper/msg_dispatcher.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/compute/internal/keeper/msg_dispatcher.go b/x/compute/internal/keeper/msg_dispatcher.go index 48f41cbe89..bf926f982b 100644 --- a/x/compute/internal/keeper/msg_dispatcher.go +++ b/x/compute/internal/keeper/msg_dispatcher.go @@ -246,8 +246,8 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk } else if msg.Msg.Stargate != nil { msgType = "stargate" } - ctx.Logger().Debug(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] id=%s type=%s replyOn=%s gasLimit=%v detail=%s gasBefore=%d", - ctx.BlockHeight(), i, string(msg.ID), msgType, msg.ReplyOn, msg.GasLimit, msgDetail, ctx.GasMeter().GasConsumed())) + ctx.Logger().Debug(fmt.Sprintf("[DispatchSubmessages] height=%d msg[%d] id=%d type=%s replyOn=%s gasLimit=%v detail=%s gasBefore=%d", + ctx.BlockHeight(), i, msg.ID, msgType, msg.ReplyOn, msg.GasLimit, msgDetail, ctx.GasMeter().GasConsumed())) if d.keeper.GetLastMsgMarkerContainer().GetMarker() { return nil, sdkerrors.ErrLastTx.Wrap("Cannot send messages or submessages after last tx marker was set")