Open hats-bug-reporter[bot] opened 10 months ago
These are pure functions, not methods of the contract (so also no #[ink(message)]
attribute needed), i.e. they don't operate on any "self
state", and so they don't need the parameter.
Thank you for participation. After carefully reviewing the submission we've concluded that this issue is INVALID.
We hope you participate in the future audits of ink!.
Github username: -- Twitter username: -- Submission hash (on-chain): 0x5f3db33b785c1d1ebccaa80da95e44d793c070768c8ae8793fbce289bf77cf68 Severity: medium
Description: Description\
&mut self
or&self
, parameter is not included for method ofrewards_per_share_in_time_interval
andrewards_earned_by_shares
infarm
contract making them unable to access.Attack Scenario\
As per Ink Official docs: “the function template included self as the first parameter of the contract functions. It is through self that you gain access to all your contract functions and storage items.”
self
parameter absence will make functions ofrewards_per_share_in_time_interval
andrewards_earned_by_shares
unable to access in either case; whether they are used for reading or writing purpose.Attachments
https://github.com/Cardinal-Cryptography/common-amm/blob/0a7264d707aea51b559a1bf94448681b59660f6a/farm/contract/lib.rs#L423
https://github.com/Cardinal-Cryptography/common-amm/blob/0a7264d707aea51b559a1bf94448681b59660f6a/farm/contract/lib.rs#L446
No
#[ink(message)]
attribute defined forrewards_per_share_in_time_interval
andrewards_earned_by_shares
methods as they are clearly public.rewards_per_share_in_time_interval
functionand
rewards_earned_by_shares
function.Pass
&self
as first parameter for both therewards_per_share_in_time_interval
andrewards_earned_by_shares
functions to gain access to them.If the functions are meant for modifying state pass
&mut self
parameter.