You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This duplication makes updates very cumbersome and it carries the risk of the contracts getting out of sync.
Proposed solution
Have only one contract per plugin which is used in tests and serves as example.
For instance the contract in near-plugins/tests/contracts/access_controllable/ is compiled, deployed and interacted with by integration tests in near-plugins/tests/access_controllable.rs. This happens via cargo test and is hooked up with CI.
If this contract is polished I think we can remove the AccessControllable example in the README and instead add a link to this contract's lib.rs.
According to this pattern, contracts in near-plugins/tests/contracts/ are integrated with cargo test and CI. Therefore I would argue no additional contracts are needed in examples/**. Instead examples link to near-plugins/tests/contracts/ too.
In addition, unit tests in /near-plugins/src/*.rs can be replaced by the integration tests mentioned above.
The text was updated successfully, but these errors were encountered:
I'm generally in favour of reducing code duplication. The rule of thumb I think about is whether the two pieces of code will change at the same time and for the same reasons. In the case of these tests and examples I think it is true they will always change together so it makes sense to unify them in my opinion.
Please proceed with your proposed solution @mooori
Description
For example for the
Pausable
plugin there is a basically identicalCounter
contract in the following locations:mod tests
)Problem
This duplication makes updates very cumbersome and it carries the risk of the contracts getting out of sync.
Proposed solution
Have only one contract per plugin which is used in tests and serves as example.
For instance the contract in
near-plugins/tests/contracts/access_controllable/
is compiled, deployed and interacted with by integration tests innear-plugins/tests/access_controllable.rs
. This happens viacargo test
and is hooked up with CI.If this contract is polished I think we can remove the
AccessControllable
example in the README and instead add a link to this contract'slib.rs
.According to this pattern, contracts in
near-plugins/tests/contracts/
are integrated withcargo test
and CI. Therefore I would argue no additional contracts are needed inexamples/**
. Instead examples link tonear-plugins/tests/contracts/
too.In addition, unit tests in
/near-plugins/src/*.rs
can be replaced by the integration tests mentioned above.The text was updated successfully, but these errors were encountered: