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

Audit/aug7 scv #48

Merged
merged 100 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
acee55e
Initial split
vladjdk Jul 13, 2023
ef9b90a
Split off templates from resolver
vladjdk Jul 13, 2023
50ed0f0
plug queries into controller
vladjdk Jul 13, 2023
2081365
Remove current template id
vladjdk Jul 14, 2023
a070d92
tests
vladjdk Jul 20, 2023
983defe
Fix
vladjdk Jul 21, 2023
b4a2669
changeable denoms
vladjdk Jul 24, 2023
9d40d04
add optional terminate_condition for recurring job
dev8723 Jul 22, 2023
cc4fb6d
fix terminate condition validation
dev8723 Jul 25, 2023
09e266d
Merge pull request #39 from llllllluc/feat/terminate-condition
vladjdk Jul 25, 2023
74b278f
temporarily remove non compiling tests
vladjdk Jul 29, 2023
cbef5c2
fix apply_var_fn return type
dev8723 Jul 30, 2023
a0b72d0
1. decrement queue length on eviction
vladjdk Aug 7, 2023
17f0c61
2. remove second instance of q sub on execution
vladjdk Aug 7, 2023
6cfa7f9
3. disallow changing of fee_denom within config
vladjdk Aug 7, 2023
21800ea
4. support nested base64 variables
vladjdk Aug 11, 2023
fa47f51
5. replace hardcoded denom with variable
vladjdk Aug 11, 2023
5d1a88b
6. remove todo comments
vladjdk Aug 11, 2023
1ad0e96
7. replace magic numbers
vladjdk Aug 11, 2023
f393963
8. remove unused comment codeblocks
vladjdk Aug 11, 2023
f38d96d
9. emit correct edit template action attr
vladjdk Aug 11, 2023
0d93c4d
11. rename and document variables for better understanding + readability
vladjdk Aug 11, 2023
3ae4160
12. implement account config query
vladjdk Aug 11, 2023
388a08d
4. support base64 encodings of variable values
vladjdk Aug 11, 2023
2d9049f
stringify binaries
vladjdk Aug 11, 2023
df27bae
Merge branch 'test' into base64-alternative
vladjdk Aug 11, 2023
abf6bcb
fix test
vladjdk Aug 11, 2023
3c56376
Merge branch 'test' into base64-alternative
vladjdk Aug 11, 2023
ba21c16
Revert "4. support nested base64 variables"
vladjdk Aug 12, 2023
345cc9b
Merge branch 'base64-alternative' into audit/aug7-scv
vladjdk Aug 12, 2023
012f6d3
(post-audit) Static variable nesting support
vladjdk Aug 14, 2023
984728f
fix test to work
vladjdk Aug 14, 2023
518fc50
lintfix
vladjdk Aug 16, 2023
ebbbc2f
add execute_query_simulate
simke9445 Aug 17, 2023
c54e135
fix schemas
simke9445 Aug 17, 2023
1538fa2
use ResolveResponse instead of simulate
simke9445 Aug 17, 2023
61f5d0b
move cosmos types to resolver
simke9445 Aug 17, 2023
41b986a
Initial split
vladjdk Jul 13, 2023
aa01632
Split off templates from resolver
vladjdk Jul 13, 2023
f298a04
plug queries into controller
vladjdk Jul 13, 2023
a881177
Remove current template id
vladjdk Jul 14, 2023
9f77fac
tests
vladjdk Jul 20, 2023
f2569b2
Fix
vladjdk Jul 21, 2023
1abe6b8
changeable denoms
vladjdk Jul 24, 2023
01453cd
add optional terminate_condition for recurring job
dev8723 Jul 22, 2023
e6af91a
fix terminate condition validation
dev8723 Jul 25, 2023
df0b5be
temporarily remove non compiling tests
vladjdk Jul 29, 2023
d65f231
1. decrement queue length on eviction
vladjdk Aug 7, 2023
a93da29
2. remove second instance of q sub on execution
vladjdk Aug 7, 2023
7e85b18
3. disallow changing of fee_denom within config
vladjdk Aug 7, 2023
b0aae7d
4. support nested base64 variables
vladjdk Aug 11, 2023
02b030e
5. replace hardcoded denom with variable
vladjdk Aug 11, 2023
7c6c165
6. remove todo comments
vladjdk Aug 11, 2023
30f8be5
7. replace magic numbers
vladjdk Aug 11, 2023
455c8dd
8. remove unused comment codeblocks
vladjdk Aug 11, 2023
acc60b7
9. emit correct edit template action attr
vladjdk Aug 11, 2023
3c741fd
11. rename and document variables for better understanding + readability
vladjdk Aug 11, 2023
ed46271
12. implement account config query
vladjdk Aug 11, 2023
92bf392
4. support base64 encodings of variable values
vladjdk Aug 11, 2023
1ce51f1
stringify binaries
vladjdk Aug 11, 2023
f840a4a
fix test
vladjdk Aug 11, 2023
64e3213
Revert "4. support nested base64 variables"
vladjdk Aug 12, 2023
7b142c6
(post-audit) Static variable nesting support
vladjdk Aug 14, 2023
a4bf43c
fix test to work
vladjdk Aug 14, 2023
08e1324
lintfix
vladjdk Aug 16, 2023
e993b14
add execute_query_simulate
simke9445 Aug 17, 2023
b59d6de
fix schemas
simke9445 Aug 17, 2023
f1d0784
use ResolveResponse instead of simulate
simke9445 Aug 17, 2023
639f947
move cosmos types to resolver
simke9445 Aug 17, 2023
3a69513
rebase to master and fix linting
vladjdk Aug 18, 2023
5a25f97
Merge remote-tracking branch 'origin/audit/aug7-scv' into audit/aug7-scv
vladjdk Aug 18, 2023
3b59d84
Merge branch 'audit/aug7-scv' into fix/apply-var-fn
dev8723 Aug 18, 2023
fc01fd5
migrate
vladjdk Aug 18, 2023
3dce0dc
temp addition
vladjdk Aug 18, 2023
ab8d1ef
Finish migrations on controller
vladjdk Aug 19, 2023
b115ad1
Merge pull request #44 from llllllluc/fix/apply-var-fn
vladjdk Aug 21, 2023
77380b8
clippy, fmt
vladjdk Aug 21, 2023
9731ede
fix msgs validation in create job validation
dev8723 Aug 21, 2023
345220d
Normalize the strings for msgs and vars
vladjdk Aug 22, 2023
47e3747
fmt, clippy
vladjdk Aug 22, 2023
6d9fa46
Merge branch 'audit/aug7-scv' into fix-create-job-validation
dev8723 Aug 22, 2023
cc0d327
merge latest
dev8723 Aug 22, 2023
29806bc
fix test
dev8723 Aug 22, 2023
7363f85
fmt
dev8723 Aug 22, 2023
8c50b79
fix migrate
vladjdk Aug 23, 2023
a5d56a8
Remove excess variables check
vladjdk Aug 23, 2023
e21ee7c
Merge remote-tracking branch 'origin/audit/aug7-scv' into audit/aug7-scv
vladjdk Aug 23, 2023
e9e68cc
Merge pull request #59 from llllllluc/fix-create-job-validation
vladjdk Aug 23, 2023
99ecca7
add execute_* functions for resolver for simulationzz and refactor qu…
simke9445 Aug 23, 2023
da6fa5d
fix resolver query parsing
simke9445 Aug 24, 2023
86171b6
fix estimate_validate_job_creation resp
simke9445 Aug 24, 2023
663a1ec
add variable name to errors
vladjdk Aug 24, 2023
469457e
Add full transfer functionality to accounts
vladjdk Aug 25, 2023
198e2a0
clippy, fmt
vladjdk Aug 25, 2023
15fd764
nanos + nanos
vladjdk Aug 28, 2023
99dfbaf
split migrate
vladjdk Aug 28, 2023
85bc1fc
clippy, fmt
vladjdk Aug 28, 2023
0a282bc
split more migrations
vladjdk Aug 28, 2023
f00ca1d
clippy warnings
vladjdk Sep 11, 2023
0f50aa3
fmt
vladjdk Sep 11, 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
75 changes: 71 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contracts/warp-account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ schemars = "0.8"
thiserror = "1"
serde-json-wasm = "0.4.1"
json-codec-wasm = "0.1.0"
prost = "0.11.9"

[dev-dependencies]
cw-multi-test = "0.16.0"
60 changes: 48 additions & 12 deletions contracts/warp-account/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
use crate::state::CONFIG;
use crate::ContractError;
use account::{Config, ExecuteMsg, InstantiateMsg, QueryMsg, WithdrawAssetsMsg};
use account::{
Config, ExecuteMsg, IbcTransferMsg, InstantiateMsg, MigrateMsg, QueryMsg, TimeoutBlock,
WithdrawAssetsMsg,
};
use controller::account::{AssetInfo, Cw721ExecuteMsg};
use cosmwasm_std::CosmosMsg::Stargate;
use cosmwasm_std::{
entry_point, to_binary, Addr, BankMsg, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo,
Response, StdResult, Uint128, WasmMsg,
};
use cw20::{BalanceResponse, Cw20ExecuteMsg};
use cw721::{Cw721QueryMsg, OwnerOfResponse};
use prost::Message;

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn instantiate(
Expand Down Expand Up @@ -47,25 +52,56 @@ pub fn execute(
.add_messages(data.msgs)
.add_attribute("action", "generic")),
ExecuteMsg::WithdrawAssets(data) => withdraw_assets(deps, env, info, data),
ExecuteMsg::IbcTransfer(data) => ibc_transfer(deps, env, info, data),
}
}

#[cfg_attr(not(feature = "library"), entry_point)]
pub fn query(_deps: Deps, _env: Env, _msg: QueryMsg) -> StdResult<Binary> {
to_binary("")
pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
match msg {
QueryMsg::Config => {
let config = CONFIG.load(deps.storage)?;
to_binary(&config)
}
}
}

pub fn migrate(
deps: DepsMut,
_env: Env,
info: MessageInfo,
_msg: ExecuteMsg,
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> Result<Response, ContractError> {
Ok(Response::new())
}

pub fn ibc_transfer(
_deps: DepsMut,
env: Env,
_info: MessageInfo,
msg: IbcTransferMsg,
) -> Result<Response, ContractError> {
let config = CONFIG.load(deps.storage)?;
if info.sender != config.warp_addr {
return Err(ContractError::Unauthorized {});
let mut transfer_msg = msg.transfer_msg.clone();

if msg.timeout_block_delta.is_some() && msg.transfer_msg.timeout_block.is_some() {
let block = transfer_msg.timeout_block.unwrap();
transfer_msg.timeout_block = Some(TimeoutBlock {
revision_number: Some(block.revision_number()),
revision_height: Some(env.block.height + msg.timeout_block_delta.unwrap()),
})
}
Ok(Response::new())

if msg.timeout_timestamp_seconds_delta.is_some() {
transfer_msg.timeout_timestamp = Some(
env.block
.time
.plus_seconds(
env.block.time.seconds() + msg.timeout_timestamp_seconds_delta.unwrap(),
)
.nanos(),
);
}

Ok(Response::new().add_message(Stargate {
type_url: "/ibc.applications.transfer.v1.MsgTransfer".to_string(),
value: transfer_msg.encode_to_vec().into(),
}))
}

pub fn withdraw_assets(
Expand Down
14 changes: 7 additions & 7 deletions contracts/warp-account/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use cosmwasm_std::{
fn test_execute_controller() {
let mut deps = mock_dependencies();
let env = mock_env();
let info = mock_info("vlad_controller", &vec![]);
let info = mock_info("vlad_controller", &[]);

let _instantiate_res = instantiate(
deps.as_mut(),
Expand Down Expand Up @@ -133,12 +133,12 @@ fn test_execute_controller() {
fn test_execute_owner() {
let mut deps = mock_dependencies();
let env = mock_env();
let info = mock_info("vlad_controller", &vec![]);
let info = mock_info("vlad_controller", &[]);

let _instantiate_res = instantiate(
deps.as_mut(),
env.clone(),
info.clone(),
info,
InstantiateMsg {
owner: "vlad".to_string(),
funds: None,
Expand Down Expand Up @@ -195,7 +195,7 @@ fn test_execute_owner() {
],
});

let info2 = mock_info("vlad", &vec![]);
let info2 = mock_info("vlad", &[]);

let execute_res = execute(deps.as_mut(), env, info2, execute_msg).unwrap();

Expand Down Expand Up @@ -257,12 +257,12 @@ fn test_execute_owner() {
fn test_execute_unauth() {
let mut deps = mock_dependencies();
let env = mock_env();
let info = mock_info("vlad_controller", &vec![]);
let info = mock_info("vlad_controller", &[]);

let _instantiate_res = instantiate(
deps.as_mut(),
env.clone(),
info.clone(),
info,
InstantiateMsg {
owner: "vlad".to_string(),
funds: None,
Expand Down Expand Up @@ -319,7 +319,7 @@ fn test_execute_unauth() {
],
});

let info2 = mock_info("vlad2", &vec![]);
let info2 = mock_info("vlad2", &[]);

let execute_res = execute(deps.as_mut(), env, info2, execute_msg).unwrap_err();

Expand Down
6 changes: 1 addition & 5 deletions contracts/warp-controller/examples/warp-controller-schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ use std::fs::create_dir_all;
use controller::{
account::{AccountResponse, AccountsResponse},
job::{JobResponse, JobsResponse},
QueryMsg, {Config, ConfigResponse, ExecuteMsg, InstantiateMsg, SimulateResponse},
QueryMsg, {Config, ConfigResponse, ExecuteMsg, InstantiateMsg},
};
use cosmwasm_schema::{export_schema, remove_schemas, schema_for};
use cosmwasm_std::{CosmosMsg, QueryRequest};

fn main() {
let mut out_dir = current_dir().unwrap();
Expand All @@ -24,7 +23,4 @@ fn main() {
export_schema(&schema_for!(JobsResponse), &out_dir);
export_schema(&schema_for!(AccountResponse), &out_dir);
export_schema(&schema_for!(AccountsResponse), &out_dir);
export_schema(&schema_for!(SimulateResponse), &out_dir);
export_schema(&schema_for!(CosmosMsg), &out_dir);
export_schema(&schema_for!(QueryRequest<String>), &out_dir);
}
Loading
Loading