futureversecom / trn-seed

Implementation of The Root Network node in Rust, based on the Substrate framework.
https://www.therootnetwork.com
Apache License 2.0
15 stars 5 forks source link

`EthBridge.EventSend` doesn't send expected data #143

Closed ken-futureverse closed 1 year ago

ken-futureverse commented 1 year ago

Screen Shot 2022-10-03 at 19 35 53

Currently only send eventId and chainId which is an enum saying it's Ethereum or XRPL

{ chainId: { __kind: 'Ethereum' }, eventProofId: '42' }

Expecting the event to send the whole event proof info

ken-futureverse commented 1 year ago

@jordy25519 following your suggestion #146, we are able to decode the Consensus log item but looks like the data inside the request object is hashed (sp_io::hashing::keccak_256(&event.abi_encode().as_slice()).to_vec(), and that's why we cannot decode it using ethers.js. I assume you hashed it to save the storage? Should we allow a non-hashed version?

File: /Users/ken/Workspace/futureverse/seed/pallet/ethy/src/types.rs
159:    pub fn data(&self) -> Vec<u8> {
160:        match self {
161:            // Ethereum event signing requires keccak hashing the event
162:            Self::Ethereum(event) =>
163:                sp_io::hashing::keccak_256(&event.abi_encode().as_slice()).to_vec(),
164:            // XRPL tx hashing must happen before signing to inject the public key
165:            Self::XrplTx(data) => data.clone(),
166:        }
167:    }
jordy25519 commented 1 year ago

@jordy25519 following your suggestion #146, we are able to decode the Consensus log item but looks like the data inside the request object is hashed (sp_io::hashing::keccak_256(&event.abi_encode().as_slice()).to_vec(), and that's why we cannot decode it using ethers.js. I assume you hashed it to save the storage? Should we allow a non-hashed version?

File: /Users/ken/Workspace/futureverse/seed/pallet/ethy/src/types.rs
159:  pub fn data(&self) -> Vec<u8> {
160:      match self {
161:          // Ethereum event signing requires keccak hashing the event
162:          Self::Ethereum(event) =>
163:              sp_io::hashing::keccak_256(&event.abi_encode().as_slice()).to_vec(),
164:          // XRPL tx hashing must happen before signing to inject the public key
165:          Self::XrplTx(data) => data.clone(),
166:      }
167:  }

makes sense, sorry about the wild goose chase! merged the PR