Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Artemka374 committed Aug 31, 2023
1 parent 85e5070 commit a71ab41
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
11 changes: 7 additions & 4 deletions contracts/src/governance/governor/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ use ink::{
},
DefaultEnvironment,
},
prelude::vec::Vec,
prelude::{
vec,
vec::Vec,
},
};
use openbrush::{
modifiers,
Expand Down Expand Up @@ -295,10 +298,10 @@ pub trait GovernorImpl:
let message = (proposal_id.clone(), support.clone(), reason.clone(), Vec::<u8>::new()).encode();

if !signature.verify(&message, &Self::env().caller()) {
return Err(GovernanceError::InvalidSignature(Self::env().caller()))
return Err(GovernanceError::InvalidSignature)
}

self._cast_vote(proposal_id, Self::env().caller(), support, reason)
self._cast_vote_with_params(proposal_id, Self::env().caller(), support, reason, vec![])
}

/// Casts a vote with signature and parameters for a proposal from a message sender. Returns the number of votes already casted for the proposal by the sender
Expand All @@ -313,7 +316,7 @@ pub trait GovernorImpl:
let message = (proposal_id.clone(), support.clone(), reason.clone(), params.clone()).encode();

if !signature.verify(&message, &Self::env().caller()) {
return Err(GovernanceError::InvalidSignature(Self::env().caller()))
return Err(GovernanceError::InvalidSignature)
}

self._cast_vote_with_params(proposal_id, Self::env().caller(), support, reason, params)
Expand Down
7 changes: 3 additions & 4 deletions contracts/src/governance/governor/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ use crate::{
ProposalState,
Transaction,
VoteType,
ALL_PROPOSAL_STATES,
},
},
};
Expand Down Expand Up @@ -141,10 +140,10 @@ pub trait GovernorInternal:
.call_flags(CallFlags::default().set_allow_reentry(true))
.returns::<()>()
.try_invoke()
.map_err(|_| GovernanceError::ExecutionFailed(tx.clone()))?
.map_err(|_| GovernanceError::ExecutionFailed(tx.clone()))?;
.map_err(|_| GovernanceError::ExecutionFailed)?
.map_err(|_| GovernanceError::ExecutionFailed)?;
} else {
return Err(GovernanceError::ExecutionFailed(tx.clone()))
return Err(GovernanceError::ExecutionFailed)
}
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/governance/utils/votes/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub trait VotesImpl: Storage<Data> + VotesInternal + nonces::NoncesImpl + VotesE
let message = (&delegatee, &nonce, &expiry).encode();

if !signature.verify(&message, &signer) {
return Err(GovernanceError::InvalidSignature(signer))
return Err(GovernanceError::InvalidSignature)
} else {
self._use_checked_nonce(&signer, nonce)?;
self._delegate(&Some(signer), &Some(delegatee))
Expand Down
2 changes: 1 addition & 1 deletion lang/codegen/src/implementations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3149,7 +3149,7 @@ pub(crate) fn impl_governor(impl_args: &mut ImplArgs) {
reason: String,
signature: Signature,
) -> Result<Balance, GovernanceError> {
GovernorImpl::cast_vote_with_signature(self, proposal_id, support, reason, signature, params)
GovernorImpl::cast_vote_with_signature(self, proposal_id, support, reason, signature)
}

#[ink(message)]
Expand Down

0 comments on commit a71ab41

Please sign in to comment.