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

[BUG] DHT Join may not work properly #387

Closed
RyanKung opened this issue Mar 31, 2023 · 1 comment
Closed

[BUG] DHT Join may not work properly #387

RyanKung opened this issue Mar 31, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@RyanKung
Copy link
Member

RyanKung commented Mar 31, 2023

    #[tokio::test]
    async fn test_31d_41d() -> Result<()> {
	let did_1d = Did::from_str("0x32d9f459e066d1855b138d23733e4cd85fd3b7c7")?;
	let did_2d = Did::from_str("0xc63fb6194b7f253404632fdce7c7ff1ce24b6ab3")?;
	let did_31d = Did::from_str("0x99fee2794a7e3067bb97e17cb7d7fc551c596f9f")?;
	let did_41d = Did::from_str("0x0298ba2b72ef040bbd99398f96594e8d8c0d0607")?;

	let dht_1d = gen_pure_dht(did_1d).await?;
	let dht_2d = gen_pure_dht(did_2d).await?;
	let dht_31d = gen_pure_dht(did_31d).await?;
	let dht_41d = gen_pure_dht(did_41d).await?;

	dht_31d.join(did_1d)?;
	dht_31d.join(did_2d)?;

	dht_1d.join(did_31d)?;
	dht_2d.join(did_31d)?;
	{
	    let finger_31d = dht_31d.lock_finger()?;

	    assert!(finger_31d.contains(Some(did_1d)));
	    assert!(finger_31d.contains(Some(did_2d)));
	}
	let ret = dht_41d.join(did_31d).unwrap();
        assert_eq!(
            ret,
            PeerRingAction::RemoteAction(did_31d, RemoteAction::FindSuccessorForConnect(did_41d))
        );
	{
	    let finger_31d = dht_31d.lock_finger().unwrap();
	    assert!(finger_31d.contains(Some(did_1d)));
	    assert!(finger_31d.contains(Some(did_2d)));
	    assert_eq!(finger_31d.closest_predecessor(did_41d), did_2d);
	}

	let ret = dht_31d.find_successor(did_41d).unwrap();
        assert_eq!(
            ret,
            PeerRingAction::RemoteAction(did_2d, RemoteAction::FindSuccessor(did_41d))
        );

	dht_2d.join(did_1d)?;
	{
	    let finger_2d = dht_2d.lock_finger().unwrap();
	    assert!(finger_2d.contains(Some(did_1d)), "{:?}", finger_2d.list());
	}


	let ret = dht_2d.find_successor(did_41d).unwrap();
	assert_eq!(
            ret,
            PeerRingAction::Some(did_1d)
        );

	Ok(())
    }
@RyanKung RyanKung changed the title When the network size is small, DHT Join may not work properly. DHT Join may not work properly, if there are too few nodes Mar 31, 2023
@RyanKung RyanKung changed the title DHT Join may not work properly, if there are too few nodes DHT Join may not work properly Mar 31, 2023
@RyanKung RyanKung changed the title DHT Join may not work properly [BUG] DHT Join may not work properly Mar 31, 2023
@RyanKung RyanKung added the bug Something isn't working label Mar 31, 2023
@RyanKung
Copy link
Member Author

This issue will be handle by #388 #448

RyanKung added a commit that referenced this issue Jul 14, 2023
[Feat]: New feature flag: experimental, mark an implementation as experimental, which means that:1) It may not have been thoroughly tested. 2)The corresponding API may be deprecated or adjusted in the future.
[Doc]: Added document for modules.
[Refactor]: Made MessageHandlerEvent context-agnostic.
[Refactor]: Convergent implementation of logging module for wasm and defaut.
Convergent implementation of WASM and NATIVE #453
[Refactor]: Rename relay.sender() to relay.origin_sender()
[Refactor]: Reimplemented node::error::Error::code with #[repr(u32)]
[Fixed] datachannel for wasm and default
[Feat] Implemented messagehandler for correct chord related message.
Correctness of DHT #388 [BUG] DHT Join may not work properly #387
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant