Comments (8)
@lauraweindorf sorry for the late response.
The verify()
function is a private function and cannot be called from the outside. methods from the Erc20Interface
trait are the only ones that can be called from the outside, therefore, it wasn't able to decrypt your request.
Hope this helps.
from enigma-core.
Hi @AvishaiW
I just reviewed his code again. It's calling the private verify()
function from his Erc20Interface
impl's public function join_game
as:
fn join_game(game_id: U256, pub_key: H256, move_2: String, sig: Vec<u8>) {
let hash = encode(Hash::Keccak256, &move_2.as_bytes()).unwrap();
assert!(Self::verify(pub_key, hash, sig));
It seems to be the same way it's done in enigma-core/examples/eng_wasm_contracts/erc20/src/lib.rs
, where the private verify()
function is called from the ContractInferface
impl's public function mint
as:
fn mint(owner: H256, addr: H256, tokens: U256, sig: Vec<u8>) {
// verify the owner is the one who is minting.
let contract_owner: H256 = read_state!(CONTRACT_OWNER).unwrap();
assert_eq!(owner, contract_owner);
assert!(Self::verify(owner, addr, tokens, sig));
In both cases the private function is being called from the trait implementation's public function as Self::verify()
.
Just checking because he said he copied from the example code?
from enigma-core.
Hey @lauraweindorf,
I think I'm still missing some information.
from my understanding and from looking at this repo verify
is called from a function from within the SC, which seems to be ok.
Is it possible to get the code which creates the signature which is passed into the secret contract, because the SC itself seems to be fine?
Thanks!
from enigma-core.
Sorry for the delay, @AvishaiW! I'll see if I can get that info for you. Meanwhile, what do you think of that array definition/initialization:
let mut new_sig: [u8; 65] = [0u8; 65];
instead of:
let mut new_sig: [u8; 65] = [u8; 65];
The former is the way it's setup in this example secret contract:
enigma-core/examples/eng_wasm_contracts/erc20/src/lib.rs
Peter had copied from there and built his code using that as a base. I did notice that when I corrected that statement, his issue was resolved.
Thanks for looking into this!
from enigma-core.
That's strange that it fixed his issue. From my understanding that is a sufficient way of writing in rust as you can see here: https://stackoverflow.com/questions/53120755/what-does-0u8-mean-in-rust, what do you say?
from enigma-core.
oh you're right. I wonder if there's a difference between using that notation with array initialization vs a statement initializing a non-array type?
from enigma-core.
Hope this answers your question: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=23563c7e97891df1f37d7925df938481
from enigma-core.
okay, yeah that answers it. Thanks @AvishaiW!
Do you still want the code that creates the signature which is passed into his secret contract? Or should we just close this issue?
from enigma-core.
Related Issues (20)
- Core produces a delta when the function seems to not change the state
- System error if wrong contract address is passed to the secret contract computation
- The principal node returns Error when it's tried too many times HOT 3
- KeyManagement node randomly failed to start HOT 1
- In simulation mode, the quote is returned in ASCII instead of bytes
- KeyManagement: Cannot lock EpochState: WouldBlock HOT 2
- KM node panics if signature is bad length HOT 1
- Align `GetContract` IPC message to P2P HOT 1
- Move code output from verbosity level 2 to 3 HOT 4
- expected value, found struct variant `EnumVariation::Rust` HOT 2
- error: 'rustfmt' is not installed for the toolchain 'nightly-2019-05-20-x86_64-unknown-linux-gnu' HOT 1
- Remove km stack trace from EpochStateTransitionErr HOT 2
- Change the block_number type to u256 number in the KM JSON RPC
- Compilation Error `bytes32` type in Eth Contracts HOT 2
- Undocument Prefix After Decrypting Outputs of a computation
- A couple of issues with crypto_wasm::encrypt
- cargo test -- --ignored failed HOT 2
- how to run enclave test?
- ENG:SCRT swap ratio HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enigma-core.