Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: space contract parity #529

Merged
merged 28 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8124467
add vote_registry view function
pscott Aug 30, 2023
7ab6b7c
add assert in initializer function; test them
pscott Aug 30, 2023
072efe7
parity for initialize fn
pscott Aug 30, 2023
af29aaa
reorder propose arguments
pscott Aug 31, 2023
4d143c7
add comment regarding testing assert_proposal_exists
pscott Aug 31, 2023
8df0316
reorder proposal_id in fn propose
pscott Aug 31, 2023
53ec2b3
remove useless cote in test_vote_zero_address
pscott Aug 31, 2023
c0c6011
re-order proposalcreated event
pscott Aug 31, 2023
5989b97
parity with vote function
pscott Aug 31, 2023
0cf5e37
prevent re-entrency attacks in execute fn; parity with execute function
pscott Aug 31, 2023
5d7fc52
reorder function delclaration; rename cancel_upgrade to cancel
pscott Aug 31, 2023
b09524b
parity with cancel function ; add tests
pscott Aug 31, 2023
6bff80e
add invalid payload test for execute
pscott Aug 31, 2023
0ab1887
remove useless imports in test_upgrade
pscott Aug 31, 2023
687b364
reorder update_proposal; add missing assert in update_proposal
pscott Aug 31, 2023
08fdc5a
add tests for assertions in update_proposal
pscott Aug 31, 2023
d4e7476
return a SyscallResult in upgrade
pscott Aug 31, 2023
cd8be1d
Merge branch 'develop' of github.com:snapshot-labs/sx-starknet into c…
pscott Sep 1, 2023
19c81a2
add set_dao_uri / test update dao_uri
pscott Sep 1, 2023
462b978
finish testing branches
pscott Sep 1, 2023
24b09e9
Merge branch 'develop' of github.com:snapshot-labs/sx-starknet into c…
pscott Sep 1, 2023
af0347b
remove string comments
pscott Sep 4, 2023
734c9ce
Merge branch 'develop' of github.com:snapshot-labs/sx-starknet into c…
pscott Sep 4, 2023
4b5bdfa
Merge branch 'develop' of github.com:snapshot-labs/sx-starknet into c…
pscott Sep 5, 2023
128c779
change metadataURI argument order in l1-execution.test.ts
pscott Sep 5, 2023
105fb6f
fix len mismatch error in l1 test
pscott Sep 5, 2023
bdad1a6
modify stark / eth authenticators to take metadata_uri in second posi…
pscott Sep 5, 2023
fa21db0
Merge branch 'develop' of github.com:snapshot-labs/sx-starknet into c…
pscott Sep 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions starknet/src/authenticators/eth_sig.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ mod EthSigAuthenticator {
ISpaceDispatcher { contract_address: target }
.propose(
UserAddress::Ethereum(author),
metadata_uri,
execution_strategy,
user_proposal_validation_params,
metadata_uri
);
}

Expand Down Expand Up @@ -126,7 +126,7 @@ mod EthSigAuthenticator {
proposal_id,
choice,
user_voting_strategies,
metadata_uri
metadata_uri,
);
}

Expand Down
6 changes: 3 additions & 3 deletions starknet/src/authenticators/eth_tx.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ mod EthTxAuthenticator {
target.serialize(ref payload);
PROPOSE_SELECTOR.serialize(ref payload);
author.serialize(ref payload);
metadata_uri.serialize(ref payload);
execution_strategy.serialize(ref payload);
user_proposal_validation_params.serialize(ref payload);
metadata_uri.serialize(ref payload);
let payload_hash = poseidon::poseidon_hash_span(payload.span());

consume_commit(ref self, payload_hash, author);

ISpaceDispatcher { contract_address: target }
.propose(
UserAddress::Ethereum(author),
metadata_uri,
execution_strategy,
user_proposal_validation_params,
metadata_uri
);
}

Expand Down Expand Up @@ -104,7 +104,7 @@ mod EthTxAuthenticator {
proposal_id,
choice,
user_voting_strategies,
metadata_uri
metadata_uri,
);
}

Expand Down
4 changes: 2 additions & 2 deletions starknet/src/authenticators/stark_sig.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ mod StarkSigAuthenticator {
ISpaceDispatcher { contract_address: target }
.propose(
UserAddress::Starknet(author),
metadata_uri,
execution_strategy,
user_proposal_validation_params,
metadata_uri
);
}

Expand Down Expand Up @@ -121,7 +121,7 @@ mod StarkSigAuthenticator {
proposal_id,
choice,
user_voting_strategies,
metadata_uri
metadata_uri,
);
}

Expand Down
4 changes: 2 additions & 2 deletions starknet/src/authenticators/stark_tx.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ mod StarkTxAuthenticator {
ISpaceDispatcher { contract_address: space }
.propose(
UserAddress::Starknet(author),
metadata_uri,
execution_strategy,
user_proposal_validation_params,
metadata_uri
);
}

Expand All @@ -80,7 +80,7 @@ mod StarkTxAuthenticator {
proposal_id,
choice,
user_voting_strategies,
metadata_uri
metadata_uri,
);
}

Expand Down
15 changes: 7 additions & 8 deletions starknet/src/factory/factory.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use starknet::{ContractAddress, ClassHash};
use starknet::{ContractAddress, ClassHash, SyscallResult};

#[starknet::interface]
trait IFactory<TContractState> {
Expand All @@ -7,7 +7,7 @@ trait IFactory<TContractState> {
class_hash: ClassHash,
contract_address_salt: felt252,
initialize_calldata: Span<felt252>
) -> ContractAddress;
) -> SyscallResult<ContractAddress>;
}


Expand All @@ -16,7 +16,7 @@ mod Factory {
use super::IFactory;
use starknet::{
ContractAddress, ClassHash, contract_address_const,
syscalls::{deploy_syscall, call_contract_syscall}
syscalls::{deploy_syscall, call_contract_syscall}, SyscallResult
};
use sx::utils::constants::INITIALIZE_SELECTOR;

Expand All @@ -42,18 +42,17 @@ mod Factory {
class_hash: ClassHash,
contract_address_salt: felt252,
initialize_calldata: Span<felt252>
) -> ContractAddress {
) -> SyscallResult<ContractAddress> {
let (space_address, _) = deploy_syscall(
class_hash, contract_address_salt, array![].span(), false
)
.unwrap();
)?;

// Call initializer.
call_contract_syscall(space_address, INITIALIZE_SELECTOR, initialize_calldata).unwrap();
call_contract_syscall(space_address, INITIALIZE_SELECTOR, initialize_calldata)?;

self.emit(Event::SpaceDeployed(SpaceDeployed { class_hash, space_address }));

space_address
Result::Ok(space_address)
}
}
}
Loading
Loading